Root API
- Component status:
stable
import { Root } from "@stratakit/foundations";Root.Root
Section titled âRoot.RootâComponent to be used at the root of your application. It ensures that StrataKit styles and fonts are loaded and automatically applied to the current page or the encompassing shadow-root.
Make sure to specify the colorScheme and density props.
Example:
<Root colorScheme="dark" density="dense"> <App /></Root>colorScheme
Section titled âcolorSchemeâ"light" | "dark"(required)The color scheme to use for all components under the Root.
density
Section titled âdensityâ"dense" | undefined(optional)The density to use for all components under the Root.
portalContainer
Section titled âportalContainerâReactElement<unknown, string | JSXElementConstructor<any>> | undefined(optional)Allows to customize the root portal container element.
rootNode
Section titled ârootNodeâDocument | ShadowRoot | undefined(optional)documentThe root node to which this Root component is attached.
This needs to be set when the Root is rendered within shadow DOM or a popout window.
synchronizeColorScheme
Section titled âsynchronizeColorSchemeâboolean | undefined(optional)trueWhether to synchronize the color scheme with the parent document (or shadow-root host).
This is useful when you donât have explicit control over the color scheme of the host.
It can be disabled if you want to isolate StrataKitâs styles to <Root> and its descendants.
unstable_accentColor
Section titled âunstable_accentColorâ"aurora" | "cobalt" | undefined(optional)"aurora"The accent color to use for all components under the Root:
"aurora": StrataKitâs preferred green accent color."cobalt": Blue accent color for better compatibility with older, iTwinUI-based applications.
unstable_htmlSanitizer
Section titled âunstable_htmlSanitizerâ((html: string) => string) | undefined(optional)An HTML sanitizer function that will be used across all components wherever DOM elements are created from HTML strings.
When this prop is not passed, sanitization will be skipped.
Example:
unstable_htmlSanitizer={DOMPurify.sanitize}