Switch
Data Entry
@rockshin/tao-uiToggles a setting on or off with immediate effect.
When to use
Use Switch for settings that take effect immediately.
Recommended
- Use labels that describe the enabled state.
- Use Checkbox when the value is submitted with a form.
Avoid
- Do not use the component outside its intended interaction model.
Examples
Basic usage
Labels and sizes
Loading and disabled states
Controlled switch
onChange returns a boolean that can directly update setting state.
Loading prevents repeated toggles
Use a separate button to toggle loading and inspect the waiting state.
State labels and sizes
Keep state labels concise and readable at both sizes.
Shared size and disabled state
Multiple switches inherit configuration; a local disabled prop can override it.