-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
18ef7fe
commit a3c0dac
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { DocSectionCode } from '@/components/doc/common/docsectioncode'; | ||
import { DocSectionText } from '@/components/doc/common/docsectiontext'; | ||
|
||
export function StyleContainer(props) { | ||
const code = { | ||
basic: ` | ||
//_app.js | ||
import { PrimeReactProvider } from 'primereact/api'; | ||
root.attachShadow({ mode: 'open' }); // Open the shadowRoot | ||
const mountHere = root.shadowRoot; | ||
const options = { appendTo: mountHere, styleContainer: mountHere}; | ||
ReactDOM.createRoot(mountHere).render( | ||
<React.StrictMode> | ||
<PrimeReactProvider value={options}> | ||
<App /> | ||
</PrimeReactProvider> | ||
</React.StrictMode> | ||
); | ||
` | ||
}; | ||
|
||
return ( | ||
<> | ||
<DocSectionText {...props}> | ||
<p> | ||
This option allows <i>useStyle</i> to insert dynamic CSS styles into a specific container. This is useful when styles need to be scoped such as in a{' '} | ||
<a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM" target="_blank"> | ||
Shadow DOM | ||
</a> | ||
. By default all dynamic styles are appended to <i>document.head</i>. | ||
</p> | ||
</DocSectionText> | ||
<DocSectionCode code={code} hideToggleCode import hideCodeSandbox hideStackBlitz /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters