Skip to content

Composition

Compose style chains, slots, scopes, and css props safely.

Composition in Fluentic Style happens in three places.

const base = style({
borderRadius: 6,
});
const card = style()
.merge(base)
.hover({
transform: 'translateY(-1px)',
});

Use this for shared standalone style fragments.

const theme = style.scope([
baseTheme,
compactTheme,
]);

Scopes can contain other scope items and slot overrides.

<button css={[css.root, isLoading && css.loading, props.css]} />

This is the right place for conditionals that depend on render state.

NeedUse
A reusable component partstyle.slot
A visual fragmentstyle
A component themestyle.scope
A one-off element overridecss prop
A render-time conditional classcss={[condition && item]}