#044
Switch rows
Two setting rows, each with a label, a description and a Switch on the right.
Hand this to your AI. It names the exact library parts, timings and accessibility promises of this demo.
Build the "Switch rows" pattern (@codeatlasdev/ui demo #044, inputs/setting-item) in my app.
Call get_demo({ ids: ["#044"] }) first and keep its structure. It needs @codeatlasdev/[email protected].
Use: Preference lists such as notification settings, one toggle per row.
Keep these library parts, with the props and tokens the demo uses:
- SettingItem, Switch from "@codeatlasdev/ui"
Behaviour to keep:
- `<SettingItem label="Email notifications" description="Receive an email for every mention.">`
- `<SettingItem label="Weekly digest" description="One summary every Monday.">`
- Each row wraps `<Switch bind:checked={email} />` or `<Switch bind:checked={digest} />` as children
- Initial state: `$state(true)` for email, `$state(false)` for digest
Reduced motion: the demo handles it; keep that branch.
Keyboard: operable; keep the focus order and key handling.
Change only the copy and the data. Use the theme tokens (--ca-*), never raw colours. Library parts
- SettingItem
@codeatlasdev/ui - Switch
@codeatlasdev/ui
How it is built
- `<SettingItem label="Email notifications" description="Receive an email for every mention.">`
- `<SettingItem label="Weekly digest" description="One summary every Monday.">`
- Each row wraps `<Switch bind:checked={email} />` or `<Switch bind:checked={digest} />` as children
- Initial state: `$state(true)` for email, `$state(false)` for digest
Related
Loading source.