Skip to main content

Overview

The useUniwind hook provides access to the current theme name and adaptive theme status. It automatically triggers a re-render when the theme changes or when adaptive themes are toggled. This is useful when you need to conditionally render components or apply logic based on the active theme.

Usage

When to Use This Hook

The useUniwind hook is ideal for scenarios where you need to:
  • Display the current theme name in your UI
  • Check if adaptive themes (system theme) are enabled
  • Conditionally render different components based on the active theme
  • Execute side effects when the theme changes
  • Access theme information for logging or analytics
For most styling use cases, you don’t need this hook. Use theme-based className variants instead (e.g., dark:bg-gray-900).

Return Values

theme
string
The name of the currently active theme (e.g., "light", "dark", "system", or any custom theme name you’ve defined).
hasAdaptiveThemes
boolean
Indicates whether adaptive themes are currently enabled. When true, the app automatically follows the device’s system color scheme. When false, the app uses a fixed theme.

Examples

Conditional Rendering Based on Theme

Using Theme in Side Effects

Displaying Current Theme

Reacting to Adaptive Theme Changes

Theming Basics

Learn how to set up and configure themes in Uniwind

Custom Themes

Create and manage custom theme configurations