Skip to content

Commit

Permalink
docs: extends docs on how 'cookie' storage can be used
Browse files Browse the repository at this point in the history
  • Loading branch information
trm217 committed May 9, 2024
1 parent f169607 commit d26eb13
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion next-themes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Let's dig into the details.
All your theme configuration is passed to ThemeProvider.

- `storageKey = 'theme'`: Key used to store theme setting in the selected storage (see `storage` property below)
- `storage`: Optional storage configuration. Defaults to 'localStorage'. Can be set to 'localStorage', 'sessionStorage'.
- `storage`: Optional storage configuration. Defaults to 'localStorage'. Can be set to 'localStorage', 'sessionStorage' or 'cookie'.
- `defaultTheme = 'system'`: Default theme name (for v0.0.12 and lower the default was `light`). If `enableSystem` is false, the default theme is `light`
- `forcedTheme`: Forced theme name for the current page (does not modify saved theme settings)
- `enableSystem = true`: Whether to switch between `dark` and `light` based on `prefers-color-scheme`
Expand Down Expand Up @@ -295,6 +295,8 @@ The available storages are:
- when using localStorage, the theme is synced across tabs and windows
- `storage='sessionStorage'`
- when using sessionStorage, the theme is only persisted for the current session, and not synced across tabs and windows
- `storage='cookie'`
- when using cookie storage, the theme is persisted in a cookie. While the value is persisted across tabs and windows, it is not synced in real-time. The theme is updated on the next page load.

### Without CSS variables

Expand Down

0 comments on commit d26eb13

Please sign in to comment.