dentil

Switch Label

SwitchLabel puts a label and an optional description next to a switch. Click the label to toggle it. The weekly digest lines its description up with the text (alignDescription="label"). The others line it up with the control. Marketing emails is disabled.

@dentil/switch-label
On this page

Send an email when a payment fails or a payout is paid.

A Monday summary of payments, aligned with the label.

Product updates and offers.

Result: payment emails on, digest off

Installation

pnpm dlx shadcn@latest add @dentil/switch-label
npx shadcn@latest add @dentil/switch-label
yarn dlx shadcn@latest add @dentil/switch-label
bunx --bun shadcn@latest add @dentil/switch-label

Files land in components/dentil/switch-label/. Uses the stock shadcn switch and label.

API reference

SwitchLabel

PropTypeDefaultDescription
labelReactNode—Text beside the switch. Clicking it toggles the switch.
descriptionReactNode—Muted line under the row. The switch points at it with aria-describedby.
alignDescription'switch' | 'label''switch'switch starts the description at the control. label starts it at the label text, including when size is sm.
classNamestring—Applied to the wrapper.
…propsComponentProps<typeof Switch>—Other props (checked, onCheckedChange, disabled, id, name, aria-invalid…) are passed to the switch. An id you pass is used; otherwise one is generated. aria-describedby is merged with the description.