useTheme to read or change the mode from inside the tree.
Set up the provider
1
Wrap your app in the provider
Mount
N3wthProvider at the root of your application. The default mode is dark; pass light or system to select another mode.2
Import the shared stylesheet once
Import
@n3wth/ui/site.css at the app root. This supplies the generated theme, component, site, and visual styles.Toggle the theme with useTheme
For an interactive app, keep the provider and toggle on the same state:useTheme options
The hook returns
theme, setTheme, toggleTheme, isDark, and isLight. Calls that use the same storage key share theme updates.
Related
Primitives
Choose between native Astryx controls and root compatibility adapters.
Tailwind
Wire the theme tokens into Tailwind v4.