← All packages

@lacspace/theme

v1.0.3React Kit0 deps

SSR-safe dark / light / system theme for React — a tiny ThemeProvider, a useTheme hook, and a no-flash inline script. Persists to storage, follows the OS, toggles a class or data-attribute. Zero-dependency, framework-agnostic, fully typed.

npm i @lacspace/theme

Usage

theme.ts
import { ThemeProvider } from "@lacspace/theme";

export default function App({ children }: { children: React.ReactNode }) {
  return (
    <ThemeProvider defaultTheme="system" enableSystem>
      {children}
    </ThemeProvider>
  );
}

Exports 3

ThemeProvidergetThemeScriptuseTheme

Keywords

reactthemedark-modelight-modenext-themesusetheme

More in React Kit