TypeScript
Types for CSS objects, props, themes, selectors, and custom style functions.
CSS properties
Section titled “CSS properties”The default style builder uses React CSS property types:
import type { CSSProperties } from '@fluentic/style';Component props
Section titled “Component props”import type { CssProp, CssTheme } from '@fluentic/style';
type Props = { css?: CssProp; theme?: CssTheme;};Style object
Section titled “Style object”import type { StyleObject } from '@fluentic/style';
const base: StyleObject<CSSProperties> = { display: 'grid',};Custom type surface
Section titled “Custom type surface”import { createStyleFn, type } from '@fluentic/style';
type AllowedStyles = Pick<CSSProperties, 'color' | 'backgroundColor'>;
const { style } = createStyleFn({ style: type<AllowedStyles>, selectors: {},});Use custom style functions when you want a constrained styling API for a design system or a domain-specific component package.