# Switch (@limerdev/zest)
An on/off switch with `bind:checked`, for a setting that applies at once. With `name` it submits with a form. Inside a `Field` it takes its id, label, description, error and disabled state from the Field; use `orientation="horizontal"` to put the label beside it.
- Category: Data input
- Import: `import { Switch } from '@limerdev/zest'`
- Bits UI: `Switch`, https://bits-ui.com/docs/components/switch
- Exports: `Switch`
- Use for: A setting that takes effect immediately: notifications on, dark rows, show archived.
- Don't: A choice that only counts when a form is submitted: use `Checkbox`. A Switch without a label.
```svelte
Show archived projects
```
Props of `Switch`:
- `checked` (`boolean`, default `false`, bindable): The checked state of the switch.
- `disabled` (`null | false | true`, default `false`): Whether the switch is disabled.
- `name` (`string`, default `undefined`): The name of the switch used in form submission. If not provided, the hidden input will not be rendered.
- `onCheckedChange` (`OnChangeFn`): A callback function called when the checked state changes.
- `required` (`boolean`, default `false`): Whether the switch is required (for form validation).
- `value` (`any`, default `undefined`): The value of the switch used in form submission.
Example: Basic
A Switch applies at once.
```svelte
Show archived projects
```
Example: Settings
A list of settings: label and description first, the switch at the end.
```svelte
Email me when a week is approved
One email per approved week.
Remind me on Fridays
If the week has days without hours.
Weekly summary
Turned off by your organisation.
```