Skip to Content
UI Kit

Theming

Semantic CSS variables, light and dark mode scopes, and overlay portals.

Semantic tokens

All visual tokens live in src/styles/theme.css. Components bind exclusively to semantic Tailwind v4 tokens (bg-card, text-foreground, text-muted-foreground, border-border, bg-info-soft, text-success, text-warning, text-destructive, etc.) so host applications can re-theme every component without modifying component source.

Light & Dark Mode

theme.css supports both class-based and attribute-based theme switching out of the box:

  • .dark on <html> (used by Fumadocs and Tailwind defaults)
  • data-theme="dark" / data-theme="light" on any root or embedded preview subtree

Scoped Overlay Portals

When rendering popovers, menus, dialogs, or pickers inside a theme-scoped subtree, wrap the subtree with OverlayContainer so Base UI portals inherit the same CSS custom properties.

On this page