tanstack-start-themes
v0.0.8
Published
An abstraction for themes in your Tanstack app.
Readme
tanstack-start-themes
An abstraction for themes in your Tanstack app.
Install
npm install tanstack-start-themes
# or
bun install tanstack-start-themesUsage
go to src/routes/__root.tsx
set suppressHydrationWarning to html tag
<html suppressHydrationWarning>{...}</html>import THEME_INIT_SCRIPT and put it inside <head> tag
import { THEME_INIT_SCRIPT } from 'tanstack-start-themes'
<head>
<script dangerouslySetInnerHTML={{ __html: THEME_INIT_SCRIPT }} />
</head>import and wrap your app inside ThemeProvider
import { ThemeProvider } from 'tanstack-start-themes'
<body>
<ThemeProvider>{children}</ThemeProvider>
</body>use useTheme hook to update and get value of active and resolved theme
const { theme, setTheme, resolvedTheme } = useTheme()Development
- Install dependencies:
npm install- Run the playground:
npm run play- Run the unit tests:
npm run test- Build the library:
npm run build