CSS Custom Properties
The library uses CSS custom properties (CSS variables) for theming. Override these variables to customize the appearance:Custom Theme Example
Create a custom theme by overriding variables:Dark Mode
Implement dark mode using CSS variables:Component-Specific Styling
Override styles for specific components:Scoped Theming
Apply different themes to different parts of your app:Available Variables
Colors
| Variable | Default | Description |
|---|---|---|
--primary-color | #007bff | Primary brand color |
--primary-hover | #0056b3 | Primary hover state |
--secondary-color | #6c757d | Secondary color |
--danger-color | #dc3545 | Danger/error color |
--success-color | #28a745 | Success color |
Typography
| Variable | Default | Description |
|---|---|---|
--font-family | System fonts | Font family |
--font-size-base | 1rem | Base font size |
--font-weight-medium | 500 | Medium font weight |
--line-height-base | 1.5 | Base line height |
Spacing
| Variable | Default | Description |
|---|---|---|
--spacing-xs | 0.25rem | Extra small spacing |
--spacing-sm | 0.5rem | Small spacing |
--spacing-md | 1rem | Medium spacing |
--spacing-lg | 1.5rem | Large spacing |
Borders
| Variable | Default | Description |
|---|---|---|
--border-radius | 0.375rem | Border radius |
--border-width | 1px | Border width |
--border-color | #dee2e6 | Border color |
Best Practices
Use semantic color names
Use semantic color names
Define colors based on their purpose (primary, danger) rather than their appearance (blue, red).
Maintain contrast ratios
Maintain contrast ratios
Ensure text and interactive elements meet WCAG AA standards (4.5:1 for normal text).
Test in both themes
Test in both themes
If implementing dark mode, test all components in both light and dark themes.
Use relative units
Use relative units
Use rem/em for spacing and sizing to support user font size preferences.