Native Solid 2 fork. Original documentation and designs © WorkOS; historical posts retain their original context.
Styling
Radix Primitives are unstyled—and compatible with any styling solution—giving you complete control over styling.
Styling overview
Functional styles
You are in control of all aspects of styling, including functional styles. For example—by default—a Dialog Overlay won't cover the entire viewport. You're responsible for adding those styles, plus any presentation styles.
Classes
All components and their DOM-rendering parts accept a class prop. This class is passed through to the DOM element.
Data attributes
When components are stateful, their state will be exposed in a data-state attribute. For example, when an Accordion Item is opened, it includes a data-state="open" attribute.
Styling with CSS
Styling a part
You can style a component part by targeting the class that you provide.
Styling a state
You can style a component state by targeting its data-state attribute.
Styling with JavaScript
Native Solid supports style objects. Use them for dynamic values and CSS classes for selectors or state-dependent rules; React-only styling wrappers cannot render native Solid primitives.
Styling a part
Styling a state
You can style a component state by targeting its data-state attribute.
Extending a primitive
Extend a primitive with a native Solid component. Preserve its reactive props and forward them to the semantic host:
Summary
Radix Primitives were designed to encapsulate accessibility concerns and other complex functionalities, while ensuring you retain complete control over styling.
For convenience, stateful components include a data-state attribute.