Theming

Sona UI is built with Tailwind CSS, making theming straightforward and flexible. Components use semantic CSS variables and work with any light/dark mode strategy. This documentation site uses next-themes, while Vite projects can use the same tokens with their preferred theme provider.

Sona theme foundation

Most components use the standard semantic tokens created by shadcn, including background, foreground, primary, muted, accent, popover, border, and ring.

Components that need Sona-specific tokens declare sona-theme as a registry dependency. The shadcn CLI merges those CSS variables into the consumer's Tailwind CSS v4 theme automatically. The foundation is intentionally small and currently adds the Sona radius plus danger-state colors; it does not copy the documentation site's full stylesheet into consumer projects.

You can override these values after installation. Components continue to reference semantic names, so custom themes do not require editing component internals.

Dark Mode

Sona UI components are designed to look great in both light and dark modes. We use CSS variables (custom properties) to handle color schemes, which makes it easy to switch themes without rewriting styles.

Setting up next-themes

For a Next.js application using next-themes, install the package and wrap your application in a ThemeProvider. This step is not required for Vite projects using a different theme strategy.

TypeScript
src/app/providers.tsx

Then use it in your layout:

TypeScript
src/app/layout.tsx

Customizing Colors

You can customize the color palette by overriding the CSS variables in your Tailwind CSS entry file, usually src/app/globals.css in a Next.js app. Sona UI uses standard semantic variable names like --background, --foreground, --primary, and --border.

css
src/app/globals.css

When you use next-themes with attribute="class", prefer explicit :root and .dark values like the example above. That keeps theme switching controlled by the .dark class instead of depending on the browser's color-scheme.

Styling Components

Since Sona UI gives you the source code, you can style individual components directly in the TSX files using standard Tailwind classes.

TypeScript