Styling with StyleX
Create styles with StyleX. Apply them through xstyle after component defaults.
Choose a primitive · Configure StyleX · Enforce conventions
Use stylex.create for styles. Pass a style to a copied component through
xstyle. The component applies this style after its defaults and variants. For
native HTML or framework elements, spread stylex.props(...) instead. Do not
pass CSS properties or styling aliases as JSX attributes.
Use controlXstyle for Input and Textarea wrappers. Use
SheetPopup.surfaceXstyle for the inner Sheet surface.
Create responsive rules, state selectors, and themes inside stylex.create. Use
semantic tokens instead of literal colors. Pass an array to xstyle to combine
styles. Later entries override matching properties. Use className for
integration with external CSS.
Box is the default container. It sets box sizing and minimum inline size. Use
render for semantic native tags. Choose Flex, Stack, Grid, or Center
for layouts with additional defaults. Use Heading, Text, or Link for text.