Runtime
Learn how StyleProvider, useCss, and sheets fit together.
The runtime is intentionally small. Its job is not to parse CSS; it resolves builder metadata into CSS instances and inserts rules that are not already extracted.
useCss
Section titled “useCss”const css = useCss(styles, ...scopeTargets);useCss:
- Reads the current runtime context.
- Reads inherited scope context.
- Normalizes scope target inputs.
- Gets a cached CSS instance from the instance pool.
- Inserts runtime rules when CSS has not been extracted.
StyleProvider
Section titled “StyleProvider”import { StyleProvider } from '@fluentic/style';
export function App() { return ( <StyleProvider> <Routes /> </StyleProvider> );}StyleProvider creates a local runtime context with its own instance pool and
style sheet. If you do not render one, Fluentic Style uses a default singleton
context.
Use a provider when you want isolation for tests, embedded apps, or server/client boundaries.
Style sheets
Section titled “Style sheets”The public sheet utilities include:
createStyleSheetcreateMemoryStyleSheetsetGlobalSheetMost apps do not need to touch these directly. They are useful when integrating with SSR, tests, or custom runtimes.