Toggle
An on/off switch that produces a boolean true or false value.
The Toggle field renders a switch control that the user can flip between on and off states. It produces a boolean value and is ideal for opt-in/opt-out choices, feature flags, or any yes/no decision where a visual switch feels more natural than a single checkbox.
For the shared properties available on all fields (label, help, note, key, width, visual styling, required), see the Form Fields Overview.
Configuration
| Property | Type | Default | Description |
|---|---|---|---|
| defaultOn | boolean | false | Whether the toggle starts in the "on" position |
Validation
The Toggle field extends InputFieldBase, so the required toggle is available. When required, the user must set the toggle to "on" before the form can be submitted. This is useful for terms-of-service acceptance or mandatory opt-in flows.
Example Usage
A terms acceptance toggle that must be enabled:
{
"type": "toggle",
"label": "I agree to the Terms of Service",
"required": true,
"defaultOn": false
}