Styling
Learn how to style Bits UI components.
We ship almost zero styles with Bits UI. This is intentional. We want to give you the most flexibility possible when it comes to styling your components.
For each component that renders an HTML element, we expose a class
prop that you can use to apply styles to the component. This is the recommended and most straightforward way to style them.
CSS frameworks
If you're using a CSS framework like TailwindCSS or UnoCSS, you can simply pass the classes you need to the component, and they will be applied to the underlying HTML element.
Data attributes
A data attribute is applied to each element rendered by Bits UI, which you can use to target the component across your entire application. Check out the API reference of the component to determine what those data attributes are.
You can then use those data attributes like so:
Define global styles
Import stylesheet
Now every <Button.Root />
component will have the styles applied to it.
Global classes
If you prefer the class approach, you can simply apply your global classes to the component.