Palette Switcher
A segmented control that allows users to choose between different color palettes (neutral, slate, gray, zinc, stone).
Features
- Shows all five palette options at once
- Highlights the currently selected palette
- Persists the palette preference to
localStorageunderzen.palette - Changes apply instantly via CSS custom properties
Available palettes
| Palette | Description |
|---|---|
| neutral | Pure gray with no color tint (default) |
| slate | Cool blue-gray tones |
| gray | Slight blue tint |
| zinc | Subtle blue undertones |
| stone | Warm tan/brown tones |
Programmatic usage
Use the useTheme hook to control the palette programmatically.
import { useTheme } from '@umami/react-zen';
function MyComponent() {
const { palette, setPalette } = useTheme();
return (
<Button onPress={() => setPalette('slate')}>
Current palette: {palette}
</Button>
);
}With ZenProvider
Set the default palette for your application.
import { ZenProvider } from '@umami/react-zen';
function App() {
return (
<ZenProvider palette="slate">
<YourApp />
</ZenProvider>
);
}Component props
| Name | Type | Description |
|---|---|---|
| className | string | Additional CSS classes |