Getting Started
Theming
baseui-cn uses CSS custom properties for theming. Tokens are defined as raw color values and mapped into Tailwind utilities through @theme, so utility classes like bg-primary/50.
CSS variables
Added to your configured stylesheet, such as app/globals.css or src/styles.css, by npx baseui-cn init.
Tailwind v4 theme mapping
Add this @theme block so utilities like bg-primary and text-muted-foreground resolve to your variables.
Customizing your theme
Override any variable in your :root. Changes propagate to every component automatically.
Dark mode
Uses the .dark class strategy. Add the class to your <html> element. We recommend next-themes for automatic system preference detection.
Base UI data attributes
Base UI applies these attributes to components. Use them in Tailwind for state-based styling.
data-[open]Overlay or disclosure is opendata-[closed]Overlay is closed — use for exit animationsdata-[checked]Checkbox, switch, or radio is checkeddata-[indeterminate]Checkbox is indeterminatedata-[disabled]Component is disableddata-[highlighted]List item is focused/highlighteddata-[selected]Select item is selecteddata-[starting-style]Entry animation start statedata-[side=top|bottom|left|right]Floating element placementAccordion & Collapsible animations
Add these keyframes to your main stylesheet for smooth height transitions.