Skip to content
Klarhimmel UI

Settings switch row

npx shadcn add @klarhimmel/settings
DetailsAbout, 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
settings-switch-row.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { SettingsSwitchRow } from '@/components/klarhimmel/ui/settings';

export default function Example() {
  return (
    <Theme theme="brand">
      <SettingsSwitchRow label="Customer sign-in" description="Adds a Sign in link to your live pages." defaultChecked onCheckedChange={(on) => console.log(on)} />
    </Theme>
  );
}

Import

Import

import { SettingsSwitchRow } from '@/components/klarhimmel/ui/settings';
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

PropTypeDefaultDescription
labelReactNoderequiredThe row's words.
descriptionReactNode-The row's words.
checkedboolean-Controlled or uncontrolled state.
defaultCheckedboolean-Controlled or uncontrolled state.
disabledboolean-Prevents interaction; posts with a form.
namestring-Prevents interaction; posts with a form.
classNamestring-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".