ColorSchemeProvider

ColorSchemeProvider is an optional React context provider to enable dark mode.

Props

Component props
Name
Type
Default
children
Required
React.Node
-
colorScheme
"light" | "dark" | "userPreference"
"light"

The color scheme for components inside the ColorSchemeProvider. Use 'userPreference' to allow the end user to specify the color scheme via their browser settings, using the 'prefers-color-scheme' media query. See color scheme variant for examples.

id
?string
-

An optional id for your color scheme provider. If not passed in, settings will be applied as globally as possible (ex. setting color scheme variables at :root).

Variants

Color scheme

Specify a light or dark color scheme for components