sheengemologic ui
All components

ThemeProvider

Owns application theme state, scoped overlays, messages, and root-only persistence.@gemologic/sheen · theming

Playground

<ThemeProvider defaultMode="dark" locale="en-US" defaultDensity="comfortable" defaultMode="dark" defaultMotion="full" defaultRadius="soft" direction="ltr" hydration="client" locale="en-US"><Button>Save</Button></ThemeProvider>

Variant matrix

Dark application root
defaultMode: dark
defaultMode: light
defaultMode: system
defaultDensity: compact
defaultDensity: comfortable
defaultDensity: spacious
defaultRadius: sharp
defaultRadius: soft
defaultRadius: round
defaultMotion: full
defaultMotion: reduced
direction: ltr
direction: rtl
hydration: client
hydration: cookie

Anatomy

Package
@gemologic/sheen
Source
packages/ui/src/theme/ThemeProvider.tsx
Tokens
None

Accessibility

Role: context providerKeyboard: No component-owned keys

Do

  • Install the theme prepaint script in client hydration mode.

Do not

  • Do not choose initial markup from browser-only state.

Generated props

NameTypeDefaultDescription
initialStateThemeStateDeterministic initial state; cookie mode requires identical server/client state.
defaultModeMode | "system"darkFresh-install preference; system follows the OS only when explicitly selected.
defaultThemestringobsidianDefault registered theme ID.
defaultAccentimport("@gemologic/sheen-tokens").AccentNamejadeDefault independent accent preset.
defaultDensity"compact" | "comfortable" | "spacious"comfortableDefault control density.
defaultRadius"sharp" | "soft" | "round"softDefault corner treatment.
defaultMotion"full" | "reduced"fullDefault motion preference; OS reduced motion still wins.
direction"ltr" | "rtl"ltrExplicit writing direction.
localestringen-USExplicit server/client Intl locale.
themesreadonly ThemeMetadata[]Registered themes. Load their CSS and configure the same prepaint catalog.
storageKeystringsheenRoot preference storage key.
hydration"client" | "cookie"clientClient prepaint handoff or cookie-authoritative SSR.
persist(state: ThemeState) => Promise<void>Cookie-mode app callback, awaited before accepting preference changes.
onPersistenceError(error: unknown) => voidReports failed storage or cookie persistence.
noncestringCSP nonce for generated scope scripts; match the document policy.
messagesPartial<Messages>Partial translations inheriting English defaults.
Native Solid/HTML attributes remain available and are omitted from this authored-prop view.