Switch
Switch Row
NewA settings list with a name and description on the left and a switch on the right of every row.
npx motionsnack add switch-rowCustomize
<SwitchRow />Props
14 properties
| Property | Type | Default | Description |
|---|---|---|---|
| rows | { id: string; label: string; description?: string; defaultChecked?: boolean; disabled?: boolean }[] | 5 demo settings | The settings, one row each. |
| value | Record<string, boolean> | - | Controlled states by row id. Leave undefined to let the component manage them. |
| defaultValue | Record<string, boolean> | - | States on first render when uncontrolled; a row's own defaultChecked is used when missing here. |
| onChange | (value: Record<string, boolean>) => void | - | Called with every row's state (by row id) after a row changes. |
| onRowChange | (id: string, checked: boolean) => void | - | Deprecated: called with the row id and its new state. Use onChange. |
| name | string | - | Name prefix for form submission; each switch is sent as name[id]. |
| className | string | '' | Extra classes on the wrapper. |
| title | string | 'Notifications' | Heading of the list. Empty hides it. |
| description | string | 'Pick how we keep you posted.' | Line under the heading. Empty hides it. |
| variant | 'plain' | 'card' | 'plain' | Rows straight on the page, or inside a bordered card. |
| size | 'sm' | 'md' | 'lg' | 'md' | Size of the switches: S 28x16, M 36x20, L 44x24. |
| error | string | '' | Error message under the list. |
| errorColor | string | '' | Overrides the per-theme error colour. Empty uses the theme pair. |
| disabled | boolean | false | Disables every row. |
About Switch Row
Switch Row is the settings screen pattern people know from their phones: a short heading, then one row per option with its name and a line of explanation on the left and a switch on the right. The whole row is the click target, rows are divided by hairlines and tint softly under the pointer, and a row can be shown but disabled, for something that is coming soon. It sits straight on the page or inside a bordered card, with switches in three sizes that slide and stretch like the library's toggle. Values come keyed by row id, controlled or not, every switch can post with a form, and keyboard focus shows the same soft outline as every other field.
What's included
- Name and description on the left, switch on the right
- Whole row clickable, hairline dividers and hover tint
- Plain or card layout
- Disabled rows for options coming soon
- Values keyed by row id, controlled or uncontrolled
- Three switch sizes and form names per row
- Light and dark look
- Type
- Animated React switch component
- Library
- Components · Switch
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-11-23
- Install
npx motionsnack add switch-row