(() => {
function Demo() {
const { mode, toggle } = useTheme();
return <Space size="sm">
<Badge tone="info">{mode}</Badge>
<Button onClick={toggle}>Switch theme</Button>
</Space>;
}
return <Demo />;
})()
useTheme
src/components/theme.tsx
Import
import { useTheme } from "@ossrandom/design-system";
Examples
API
Hooks have no prop interface. Call useTheme() from inside a component to use it.