Theme
Advanced theming components that provide comprehensive visual customization for your application. The theme system includes Theme
for advanced styling options and ThemeProvider
for managing light/dark modes.
Import
import { Theme, ThemeProvider, useTheme } from '@beauginbey/vanilla-components';
Basic Usage
Wrap your application with ThemeProvider
and Theme
to enable theming.
Theme Toggle
Use the useTheme
hook to create theme toggles and access theme state.
Accent Colors
Theme supports various accent colors to customize the primary color scheme.
Gray Colors
Customize the gray color palette used throughout your application.
Appearance
Control the overall theme appearance (light/dark) at the Theme level.
Complete Theme Configuration
Combine all theme options for full customization.
Props
ThemeProvider Props
Prop | Type | Default | Description |
---|---|---|---|
defaultTheme | 'light' | 'dark' | 'light' | Default theme mode |
storageKey | string | 'theme' | LocalStorage key for persisting theme |
children | ReactNode | - | Child components |
Theme Props
Prop | Type | Default | Description |
---|---|---|---|
accentColor | AccentColor | 'blue' | Primary accent color |
grayColor | GrayColor | 'gray' | Gray color palette |
appearance | 'light' | 'dark' | 'inherit' | 'inherit' | Theme appearance |
panelBackground | 'solid' | 'translucent' | 'translucent' | Panel background style |
radius | 'none' | 'small' | 'medium' | 'large' | 'full' | 'medium' | Border radius scale |
scaling | '90%' | '95%' | '100%' | '105%' | '110%' | '100%' | UI scaling factor |
useTheme Hook
Returns an object with:
theme
: Current theme ('light'
or'dark'
)setTheme
: Function to update themetoggleTheme
: Function to toggle between light and dark