Some properties provide flexibility for specific integrations. Follow the component's usage guidance. Customizations beyond the documented patterns need a use case approved by DNB UX. Read about intended use and customization.
Properties#
| Type | Description | |
|---|---|---|
ref | React.Ref<HTMLElement> React.RefObject<HTMLElement> | (optional) The ref of the element that will be used. |
id | string | (optional) The id used for the portal root element. Defaults to eufemia-portal-root. If an element with this id already exists in the DOM, it will be reused. |
insideSelector | string | (optional) CSS selector for a container to place the portal root inside. The portal element is inserted as the first child of the matched element. |
beforeSelector | string | (optional) CSS selector for a target element; the portal root will be inserted directly before the first matched element. |
children | React.ReactNode | (required) The content that will be placed in a React Portal. |
[HTML attributes] | "various" | (optional) When used on PortalRoot.Provider, any extra HTML attributes (e.g. translate, lang, dir, data-*) are forwarded to the portal DOM element. Props on PortalRoot itself take precedence. |