Skip to main content

Overview

Radix UI Primitives are completely unstyled by default. This gives you complete control over the styling without having to override opinionated design decisions. You can style components using:
  • Plain CSS or CSS Modules
  • CSS-in-JS libraries (styled-components, Emotion, etc.)
  • Utility-first frameworks (Tailwind CSS)
  • Inline styles
  • Any other styling solution that works with React
The unstyled approach means you’re responsible for all visual styling, including layouts, colors, typography, animations, and responsive behavior.

Styling Approaches

Plain CSS

The simplest approach is using regular CSS classes:

CSS Modules

CSS Modules provide scoped styling:

Styled Components

Use styled-components or Emotion for CSS-in-JS:

Tailwind CSS

Radix UI works excellently with Tailwind CSS:
Use Tailwind’s data-* attribute selectors to style different component states: data-[state=open], data-[state=checked], etc.

Data Attributes

Radix components expose data attributes that you can use for styling:

State Attributes

Many components expose their state via data-state:

Disabled State

Components expose a data-disabled attribute when disabled:

Orientation

Some components like Slider and Toolbar expose orientation:

Side and Align

Positioned components like Tooltip and Popover expose side and alignment:

Animating with Data Attributes

You can create smooth animations using data attributes:
Some components provide CSS variables (like --radix-accordion-content-height) that you can use in your animations.

CSS Variables

Radix components expose CSS variables for dynamic values:

Styling Best Practices

1

Start with layout and structure

First, establish the basic layout and positioning using CSS or your preferred framework.
2

Add interactive states

Use data attributes to style hover, focus, active, and disabled states.
3

Implement animations

Add smooth transitions and animations for state changes using data attributes.
4

Ensure accessibility

Test with keyboard navigation and screen readers. Make sure focus indicators are visible.
5

Make it responsive

Use media queries or responsive utilities to adapt to different screen sizes.

Common Patterns

Focus Visible

Style focus states for keyboard navigation:

Hover and Active States

Responsive Design

Examples by Framework

Design System Integration

Radix UI Primitives work great as the foundation for design systems:
  1. Create styled wrappers - Wrap Radix components with your design system’s styling
  2. Use design tokens - Apply your design tokens (colors, spacing, typography) to Radix components
  3. Document patterns - Create a pattern library showing how to use styled components
  4. Share across teams - Distribute your styled components as a package
When creating wrapper components, make sure to forward all props and refs correctly to maintain accessibility features.

Next Steps

Composition

Learn about the composable API design

Accessibility

Understand accessibility features

Components

Browse all available components

Examples

See Radix Themes for pre-styled examples