diff --git a/components/doc/configuration/appendtodoc.js b/components/doc/configuration/appendtodoc.js index ffd30181fa..03dea8705c 100644 --- a/components/doc/configuration/appendtodoc.js +++ b/components/doc/configuration/appendtodoc.js @@ -27,7 +27,7 @@ export default function MyApp({ Component }) {

For components with an overlay like a dropdown, popups can be mounted either into the component or DOM element instance using this option. Valid values are any DOM Element like document body and self. By default all popups - are append to document body via Portals. + are appended to document body via Portals.

diff --git a/components/doc/configuration/stylecontainer.js b/components/doc/configuration/stylecontainer.js new file mode 100644 index 0000000000..f7e0735a0b --- /dev/null +++ b/components/doc/configuration/stylecontainer.js @@ -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( + + + + + +); +` + }; + + return ( + <> + +

+ This option allows useStyle to insert dynamic CSS styles into a specific container. This is useful when styles need to be scoped such as in a{' '} + + Shadow DOM + + . By default all dynamic styles are appended to document.head. +

+
+ + + ); +} diff --git a/pages/configuration/index.js b/pages/configuration/index.js index e9b44520c5..a0efc3c42f 100644 --- a/pages/configuration/index.js +++ b/pages/configuration/index.js @@ -1,5 +1,6 @@ import { DocComponent } from '@/components/doc/common/doccomponent'; import { AppendToDoc } from '@/components/doc/configuration/appendtodoc'; +import { StyleContainer } from '@/components/doc/configuration/stylecontainer'; import { CSSTransitionDoc } from '@/components/doc/configuration/csstransitiondoc'; import { FilterMatchModeDoc } from '@/components/doc/configuration/filtermatchmodedoc'; import { HideOverlaysDoc } from '@/components/doc/configuration/hideoverlaysdoc'; @@ -20,6 +21,11 @@ const InstallationPage = () => { label: 'AppendTo', component: AppendToDoc }, + { + id: 'stylecontainer', + label: 'StyleContainer', + component: StyleContainer + }, { id: 'csstransition', label: 'CSS Transition',