Skip to content

Commit 5415b9c

Browse files
committed
docs: Enhance adoptRootStyles API docs
1 parent 40a07cb commit 5415b9c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/components/chat/types.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,24 @@ export type IgcChatOptions = {
127127
stopTypingDelay?: number;
128128

129129
/**
130-
* If `true`, the component will attempt to adopt styles from the host element's document root.
130+
* A boolean flag that, when `true`, enables a **quick and dirty workaround** for styling
131+
* components rendered within the Shadow DOM, from custom message renderers, by allowing them
132+
* to inherit styles from the document's root. This can be useful for developers who prefer not to handle
133+
* Shadow DOM encapsulation, but it is **not the recommended approach**.
134+
*
135+
* It is highly advised to use standard Web Component styling methods first, in this order:
136+
*
137+
* 1. **CSS Variables and Parts API**: Use the exposed `::part` API with custom CSS variables to style
138+
* your content in your custom renderers.
139+
*
140+
* 2. **`link` elements**: For larger style sheets, link them directly within the Shadow DOM to maintain
141+
* encapsulation.
142+
*
143+
* 3. **Inline `<style>` tags**: Use these for small, self-contained styles within a template.
144+
*
145+
* This property should be used as a **last resort** as it can lead to **style leakage**, where
146+
* global styles unexpectedly bleed into the component, breaking encapsulation and causing
147+
* unpredictable visual issues.
131148
*/
132149
adoptRootStyles?: boolean;
133150

0 commit comments

Comments
 (0)