Skip to main content
Apsara uses a comprehensive CSS variable system that allows you to customize colors, spacing, typography, and more throughout your application.

CSS variable system

The theming system is built on CSS custom properties (variables) defined in the :root selector. All variables use the -- prefix and are organized into semantic categories.

Color tokens

Apsara provides semantic color tokens that automatically adapt to light and dark themes:

Typography tokens

Customize fonts and font sizes across your application:

Spacing tokens

A consistent spacing scale from 2px to 120px:

Border radius tokens

Control the roundness of component corners:

Shadow tokens

Elevation shadows for depth and hierarchy:

Customizing your theme

You can override any CSS variable to customize your theme. Create a custom CSS file and import it after the Apsara stylesheet:
custom-theme.css
App.jsx
Make sure to import your custom theme CSS after the Apsara stylesheet to ensure your overrides take precedence.

Using CSS variables in components

You can reference CSS variables directly in your custom component styles:

Component-specific tokens

Many components use their own namespaced tokens. For example, buttons use:
Component-specific tokens like --rs-* variables are automatically mapped to the global tokens, but you can override them for fine-grained control.

Best practices

Prefer semantic tokens like --foreground-accent over direct color values. This ensures your customizations work correctly in both light and dark themes.
Stick to the spacing scale (--space-*) for margins, padding, and gaps to maintain visual consistency.
Always test your customizations in both light and dark modes to ensure good contrast and readability.
Override global tokens in :root for app-wide changes, or target specific components for localized customization.

Dark mode

Learn how to implement dark mode in your application

Styling

Explore different styling approaches for components