A toggle is used to switch between two options or states. It typically has two states on or off.
Labelchildren of Toggle component.sm, md, lg and responsive and can be changed by passing the size prop.lg.responsive, the component will be responsive to the viewport.Screen prefix | Screen width | Component size |
|---|---|---|
|
| sm |
|
| md |
|
| lg |
disabled prop to true.readOnly prop to true.labelAlignment prop to left | right.labelAlignment is right.FormCheck is a helpful wrapper used to group toggle components that provides an easier API.Toggle is a regular input[type="checkbox"] follow WAI-ARIA recommendations.
role="switch".aria-labelledby set on the element with role switch.checked attribute to indicate its state:checked="true" indicates the toggle is on.checked="false" indicates the toggle is off.group.group element has the property aria-labelledby set to the ID of the element containing the group label.group element has the property aria-describedby set to the ID of the element containing the group description.Key | Function | Condition |
|---|---|---|
| Moves keyboard focus to the toggle. | |
| Changes the state of the toggle between on and off. | When the toggle has focus. |