Reads and sets the theme mode.
with no ThemeProvider above it. There is no ambient fallback, because a control that silently fails to switch is worse than one that throws in dev.
const { resolved, toggle } = useTheme()<button onClick={toggle}>{resolved === 'dark' ? 'Light' : 'Dark'} mode</button> Copy
const { resolved, toggle } = useTheme()<button onClick={toggle}>{resolved === 'dark' ? 'Light' : 'Dark'} mode</button>
Reads and sets the theme mode.