Skip to content

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.

PropTypeDescription
children*string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
storageKeystring
defaultMode"light" | "dark" | "system"
brandColorstringPrimary colour for this product. Overrides the stylesheet default.
defaultDirection"ltr" | "rtl"

Hooks

  • useTheme

Search documentation

Search pages, components and blocks.