Skip to main content
Version: 1.0.3

Hooks API Reference

useTheme()

The primary hook for accessing and controlling the current theme state.

Import

import { useTheme } from '@mindfiredigital/ignix-ui';

Return Value

PropertyTypeDescription
themeThemeConfigCurrent theme object
setTheme(themeId: string) => voidChange the current theme
mode'light' | 'dark'Current color mode
toggleMode() => voidToggle between light/dark modes

Example

function ThemeController() {
const { theme, mode, toggleMode, setTheme } = useTheme();

return (
<div className="space-y-4">
<div>
<p>Current theme: <strong>{theme.name}</strong></p>
<p>Current mode: <strong>{mode}</strong></p>
</div>

<div className="flex gap-2">
<button
onClick={toggleMode}
className="px-4 py-2 bg-gray-200 dark:bg-gray-700 rounded"
>
Toggle Mode
</button>
<button
onClick={() => setTheme('ocean-breeze')}
className="px-4 py-2 bg-blue-500 text-white rounded"
>
Set Ocean Breeze
</button>
</div>
</div>
);
}

Next