Wi-Fi
Connect to wireless networks
Component Specs: 44px width, 24px height, 20px thumb, 2px padding
States: Default, Hover, Pressed, Disabled, Active (On/Off)
Colors: gray-300 track (off), blue-600 track (on), white thumb
Variants: Basic Switch, Switch Label, Switch Card, Integration Switch
Toggle switches for binary on/off states following Align UI design system. Includes size variants, color options, labels, cards, and list styles for comprehensive UI patterns.
Status: OFF
Customize switches with various options:
tiny, small, default, large, bigprimary, positive, negative, warning, infored, orange, yellow, green, teal, blue, violet, purple, pinklabeled, labeled flip, switch-card, switch-listContainer-level inheritance allows applying size/color to multiple switches at once using .switches wrapper.
// Toggle switch state
toggleSwitch('#my-switch', true); // Turn on
toggleSwitch('#my-switch', false); // Turn off
toggleSwitch('#my-switch'); // Toggle current state
// Enable/disable switch
setSwitchState('#my-switch', true); // Enable
setSwitchState('#my-switch', false); // Disable
// Get switch value
var isChecked = getSwitchValue('#my-switch');
// Listen to change events
document.querySelector('#my-switch input')
.addEventListener('change', function(e) {
console.log('Switch changed:', e.target.checked);
});
// Integration switch events
document.querySelector('.integration-switch')
.addEventListener('integrationSwitchChange', function(e) {
console.log('Integration switches:', e.detail.allSwitches);
});
<!-- Basic Switch -->
<label class="switch">
<input type="checkbox">
<span class="track">
<span class="thumb"></span>
</span>
</label>
<!-- Switch with Label -->
<div class="switch labeled">
<label>
<input type="checkbox">
<span class="track">
<span class="thumb"></span>
</span>
</label>
<span class="label">Enable feature</span>
</div>
<!-- Switch Card -->
<div class="switch-card">
<div class="content">
<div class="text">
<div class="title">Feature Name</div>
<div class="subtitle">Description</div>
</div>
</div>
<label class="switch">
<input type="checkbox">
<span class="track">
<span class="thumb"></span>
</span>
</label>
</div>