Switch
An on/off switch.
Use it for: A yes/no field, inside a Form.
- CategoryInput
- ChildrenNone
- DataOne field (bindings.value)
- ActionNone
| Prop | Required | Accepts | What it does |
|---|---|---|---|
label |
Yes | text, up to 200 characters | The visible label, also read by VoiceOver. |
required |
No | true or false |
The form cannot be saved while this is empty. |
disabled |
No | true or false |
Show it greyed out and ignore taps. |
Every component also accepts id (required, unique on its screen), and the optional preset and style described in Style options.
Example
Section titled “Example”From the fitness example project:
{ "id": "completed", "type": "Switch", "props": { "label": "Completed", "required": true }, "bindings": { "value": { "model": "workout", "field": "completed" } }}