2.1.9 • Published 9 months ago

@heroui/use-theme v2.1.9

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@heroui/use-theme

React hook to switch between light and dark themes

Installation

yarn add @heroui/use-theme
# or
npm i @heroui/use-theme

Usage

Import useTheme

import {useTheme} from "@heroui/use-theme";

theme

// `theme` is the active theme name
// by default, it will use the one in localStorage.
// if it is no such value in localStorage, `light` theme will be used
const {theme} = useTheme();

setTheme

You can use any theme name you want, but make sure it exists in your tailwind.config.js file. See Create Theme for more details.

// set `theme` by using `setTheme`
const {setTheme} = useTheme();
// setting to light theme
setTheme('light')
// setting to dark theme
setTheme('dark')
// setting to purple-dark theme
setTheme('purple-dark')

Contribution

Yes please! See the contributing guidelines for details.

License

This project is licensed under the terms of the MIT license.

2.1.9

9 months ago

2.1.9-beta.1

9 months ago

2.1.9-beta.0

10 months ago

2.1.8

10 months ago

2.1.7

10 months ago

2.1.8-beta.2

11 months ago

2.1.8-beta.1

11 months ago

2.1.8-beta.0

11 months ago

2.1.7-beta.1

12 months ago

2.1.6

1 year ago

2.1.5

1 year ago

2.1.3

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago