You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-5Lines changed: 27 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,26 +25,43 @@ This project is inspired by `next-themes`. `next-themes` is an awesome package,
25
25
- ✅ Doccumented with [Typedoc](https://react18-tools.github.io/react18-themes) ([Docs](https://react18-tools.github.io/react18-themes))
26
26
- ✅ Use combinations of [data-th=""] and [data-color-scheme=""] for dark/light varients of themes
27
27
- ✅ Use [data-csp=""] to style based on colorSchemePreference.
28
+
- ✅ Starting from version 2.3, `localStorage` is used as default storage. **No**`cookies` by default. Use storage="cookies" for smooth initial rendering of server components.
28
29
29
30
Check out the [live example](https://react18-themes.vercel.app/).
30
31
31
32
## Install
32
33
33
34
```bash
34
35
$ pnpm add react18-themes
35
-
# or
36
+
```
37
+
38
+
**or**
39
+
40
+
```bash
36
41
$ npm install react18-themes
37
-
# or
42
+
```
43
+
44
+
**or**
45
+
46
+
```bash
38
47
$ yarn add react18-themes
39
48
```
40
49
41
50
## Want Lite Version? [](https://www.npmjs.com/package/react18-themes-lite)[](https://www.npmjs.com/package/react18-themes-lite)[](https://www.npmjs.com/package/react18-themes-lite)
42
51
43
52
```bash
44
53
$ pnpm add react18-themes-lite
45
-
# or
54
+
```
55
+
56
+
**or**
57
+
58
+
```bash
46
59
$ npm install react18-themes-lite
47
-
# or
60
+
```
61
+
62
+
**or**
63
+
64
+
```bash
48
65
$ yarn add react18-themes-lite
49
66
```
50
67
@@ -217,6 +234,10 @@ In a similar way, you can also force color scheme.
217
234
218
235
Forcing color scheme will apply your defaultDark or defaultLight theme, configurable via hooks.
219
236
237
+
## Changelog
238
+
239
+
Find changelog here [CHANGELOG.md](lib/react18-themes/CHANGELOG.md)
240
+
220
241
## Migrating from v1 to v2
221
242
222
243
#### Motivation:
@@ -226,7 +247,8 @@ For server side syncing, we need to use cookies and headers. This means that thi
226
247
Take care of the following while migrating to `v2`.
227
248
228
249
- No changes required for projects not using `Next.js` app router or server components other than updating cookies policy if needed.
229
-
- The persistent storage is realized with `cookies` in place of `localStorage`. (You might want to update cookies policy accordingly.)
250
+
-~~The persistent storage is realized with `cookies` in place of `localStorage`. (You might want to update cookies policy accordingly.)~~
251
+
- Starting from version 2.3, persistent storage is again set to `localStorage`. You can change it to `cookies` or `sassionStorage` by passing `storage` prop to `<ThemeSwitcher />` component.
230
252
- We have provided `NextJsSSGThemeSwitcher` in addition to `ServerSideWrapper` for `Next.js`. You no longer need to use a wrapper component which broke static generation and forced SSR.
"description": "Unleash the Power of React Server Components! Use multiple themes on your site with confidence, without losing any advantages of React Server Components.",
* set storage to `cookies` (recommended when using server components) or `sessionsStorage` when using only client side or when you must avoid using cookies
0 commit comments