Theming
Build themes as composable scopes instead of global class names.
In Fluentic Style, a theme is just a scope. This keeps the model small and composable.
Local theme
Section titled “Local theme”const danger = style.scope([ buttonStyles.root({ backgroundColor: 'crimson', color: 'white', }), buttonStyles.label({ fontWeight: 700, }),]);Conditional theme
Section titled “Conditional theme”<Button theme={[isDanger && danger, props.theme]} />CssTheme accepts nested arrays and falsy values.
Theme target
Section titled “Theme target”Use scopeTarget inside the component to apply incoming theme scopes to a
specific slot target.
const target = buttonStyles.root;
const css = useCss( buttonStyles, ...scopeTarget(target, props.theme),);Responsive theme
Section titled “Responsive theme”const mobileCompact = style.scope() .media('(max-width: 700px)', [ buttonStyles.root({ minHeight: 36, padding: '6px 10px', }), ]);Best practice
Section titled “Best practice”Keep themes semantic:
primaryButtondangerButtoncompactButtonAvoid themes named after a single CSS property unless they are truly utility overrides.