Skip to content

Vizel API / react/src / useVizelTheme

Function: useVizelTheme()

ts
function useVizelTheme(): UseVizelThemeResult;

Defined in: packages/react/src/hooks/useVizelTheme.ts:45

Hook to access the editor theme and a setter.

Must be used within a VizelThemeProvider.

Returns

UseVizelThemeResult

Example

tsx
const { theme, setTheme } = useVizelTheme();

return (
  <button onClick={() => setTheme(theme === "dark" ? "light" : "dark")}>
    Toggle theme
  </button>
);

Released under the MIT License.