#050
Basic
Two labelled switches, one starting off and one starting on.
Hand this to your AI. It names the exact library parts, timings and accessibility promises of this demo.
Build the "Basic" pattern (@codeatlasdev/ui demo #050, inputs/switch) in my app.
Call get_demo({ ids: ["#050"] }) first and keep its structure. It needs @codeatlasdev/[email protected].
Use: Boolean settings that take effect immediately, such as notifications.
Keep these library parts, with the props and tokens the demo uses:
- Switch from "@codeatlasdev/ui"
Behaviour to keep:
- `<Switch label="Off by default" bind:checked={darkMode} />` with `$state(false)`
- `<Switch label="On by default" bind:checked={notifications} />` with `$state(true)`
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
- Switch
@codeatlasdev/ui
How it is built
- `<Switch label="Off by default" bind:checked={darkMode} />` with `$state(false)`
- `<Switch label="On by default" bind:checked={notifications} />` with `$state(true)`
Related
Loading source.