@objectifthunes/whiteboard
BUTTONS

ThemeToggle

Controlled moon/sun toggle. You own the data-theme attribute — almost always on <html>.


PREVIEW
Currently: light
SOURCE
import { ThemeToggle } from '@objectifthunes/whiteboard'

const [theme, setTheme] = useState<'light' | 'dark'>('light')
useEffect(() => { document.documentElement.dataset.theme = theme }, [theme])

<ThemeToggle
  theme={theme}
  onToggle={() => setTheme(t => t === 'light' ? 'dark' : 'light')}
/>
NOTES

Controlled. The component owns no DOM state — you own the data-theme attribute. Almost always set it on <html> so descendant [data-theme="dark"] selectors apply.

Override the icons via lightIcon / darkIcon — useful when your design system has bespoke moon/sun glyphs.