Settings switch row
npx shadcn add @klarhimmel/settingsCopy for AIDetailsAbout, usage, props and more
A row with a switch. The whole row toggles, and the switch is named by the label and its hint.
Preview
Settings switch row
Import
Import
- Files
- settings.tsx, in components/klarhimmel/ui/. With it: button, card, input, switch, theme, utils.
- Render in
- Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | required | The row's words. |
description | ReactNode | - | The row's words. |
checked | boolean | - | Controlled or uncontrolled state. |
defaultChecked | boolean | - | Controlled or uncontrolled state. |
disabled | boolean | - | Prevents interaction; posts with a form. |
name | string | - | Prevents interaction; posts with a form. |
className | string | - | Extra classes, merged after the component's own. |
onCheckedChange | (on: boolean) => void | boolean | Promise<boolean | void> | - | Called on toggle; false or a rejection shows "Not saved". |