Single Switch
Standalone toggle for enabling or disabling a single setting
Switch Group
Related settings grouped together with column or row layout
Built-in Features
What you get out of the box with zero configuration
Auto-initializes with the forms system. Two-way binding syncs disabled state between inputs and containers. Use data-state="disabled" on the group to disable all switches at once.
Ripple effect on hover, thumb stretch on press, and smooth slide animation. Three sizes (SM, MD, LG) with proportional scaling.
Space and Enter keys toggle the switch. Track click, label click, and keyboard all fire the switchChange event.
Column layout by default, row layout with nds-rowView class. Gaps adjust on mobile for touch-friendly spacing.
Usage Guidelines
When and how to use switches effectively
When to Use
- Instant on/off actions that take effect immediately without form submission
- Settings pages, preference panels, and feature toggles
- Use checkboxes when the change requires a submit action to apply
- Use radio buttons when choosing between more than two mutually exclusive options
- Always label clearly what state "on" represents