4.2.0
PatternsTheme provider

ThemeProvider API

Every prop of the 2 parts ThemeProvider exports, plus the 1 symbol it exports alongside them, generated from the package manifest.

import { ThemeProvider, ThemeScript, useTheme } from '@oceanic-hub/brand-system'
Layer
patterns — Generic composites — the shared shell and the shared status vocabulary that make every product inherit the look. The reason this package exists.
Exports
ThemeProvider · ThemeScript · useThemetypes: ResolvedTheme · Theme · ThemeContextValue · ThemeProviderProps
Variants
  • defaultTheme: dark | light | system
  • defaultTheme: dark | light | system
Contract
packages/brand-system/src/components/theme-provider.contract.test-d.ts
Demos
2 on the ThemeProvider page — rendered live, hydrated
Source
packages/brand-system/src/components/theme-provider.tsx

Generated from manifest/component-manifest.json, so it cannot drift from the source. For what ThemeProvider is for, how it composes and what it looks like, see ThemeProvider.

ThemeProvider

ThemeProviderProps

Prop

Type

ThemeScript

{ defaultTheme?: Theme storageKey?: string attribute?: string }

Prop

Type

useTheme

A React hook.Call it inside a component rendered under this module's provider; outside one it throws, which is the contract rather than a bug.

(): ThemeContextValue

On this page