Skip to main content
The useThemeUI hook provides access to the Theme UI context, including the current theme and color mode functions.

Import

Signature

Return Value

ThemeUIContextValue
The Theme UI context object
Theme
The current theme object with all merged values
string
The current color mode (e.g., ‘default’, ‘dark’). Available when using ThemeUIProvider.
(mode: string) => void
Function to change the current color mode. Available when using ThemeUIProvider.
string
Internal version string for Emotion compatibility checking

Usage

Accessing Theme Values

Accessing Color Mode

Reading Nested Theme Values

Using with TypeScript

The hook is fully typed and will provide autocomplete for your theme:

Example: Theme-Aware Component

Example: Using in Tests

Notes

  • This hook must be used within a ThemeUIProvider or ThemeProvider component
  • The colorMode and setColorMode properties are only available when using ThemeUIProvider (not the core ThemeProvider)
  • The returned theme object is the fully merged theme, including any nested provider themes