Overriding styles
Recipes provide defaults, but components still need an escape hatch for local
changes. A recipe accepts className and style alongside variant props.
Add a custom class
<button {...button({ tone: "primary", className: "focus-ring" })} />
The custom class is appended to the generated StyleX class name.
Add inline styles
<button {...button({ style: { minWidth: 160 } })} />
The supplied inline style is merged with the StyleX style object. Use this for values that are genuinely local or computed at runtime; keep reusable visual states in the recipe variants.
Precedence
Styles are composed in this order:
base- matching variant styles
- matching
compoundVariants, in declaration order - caller-provided
classNameandstyle
Prefer a new variant when an override represents a recurring component state.