Theme Provider
Provides colour mode, direction and brand colour to the tree, and applies them to the document.
Installation
bun add @xerobi/ui
import { ThemeProvider } from "@xerobi/ui/theme-provider"This component is client-side. In Astro, hydrate it with a client directive.
API reference
ThemeProvider
Mode (light/dark/system), brand colour and text direction for the whole app. Writes `.dark`, `--brand-primary` and `dir` onto <html>. Not tied to any router or framework.
| Prop | Type | Description |
|---|---|---|
| children* | string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode> | |
| storageKey | string | |
| defaultMode | "light" | "dark" | "system" | |
| brandColor | string | Primary colour for this product. Overrides the stylesheet default. |
| defaultDirection | "ltr" | "rtl" |
Hooks
useTheme