Switch
Switch
Section titled “Switch”A toggle switch component for binary on/off states.
Basic Usage
Section titled “Basic Usage”Default Switch
Basic toggle switch.
<ae-switch>Enable notifications</ae-switch>Checked State
Section titled “Checked State”Checked Switch
Switch in checked state.
<div class="demo-column"><ae-switch>Unchecked</ae-switch><ae-switch checked>Checked</ae-switch></div>Disabled State
Section titled “Disabled State”Disabled Switch
Disabled switches cannot be toggled.
<div class="demo-column"><ae-switch disabled>Disabled unchecked</ae-switch><ae-switch checked disabled>Disabled checked</ae-switch></div>Switch Sizes
Small, medium, and large sizes.
<div class="demo-column"><ae-switch size="sm">Small</ae-switch><ae-switch size="md">Medium</ae-switch><ae-switch size="lg">Large</ae-switch></div>Use Cases
Section titled “Use Cases”Settings Example
Common settings pattern.
<div class="demo-column" style="max-width: 400px;"><div style="display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid #eee;"> <div> <div style="font-weight: 500;">Dark Mode</div> <div style="font-size: 0.875rem; color: #666;">Use dark theme</div> </div> <ae-switch></ae-switch></div><div style="display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid #eee;"> <div> <div style="font-weight: 500;">Notifications</div> <div style="font-size: 0.875rem; color: #666;">Receive email updates</div> </div> <ae-switch checked></ae-switch></div><div style="display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0;"> <div> <div style="font-weight: 500;">Auto-save</div> <div style="font-size: 0.875rem; color: #666;">Save changes automatically</div> </div> <ae-switch checked></ae-switch></div></div>Installation
Section titled “Installation”pnpm add @aetherui-kit/corenpm install @aetherui-kit/coreImport
Section titled “Import”import { defineAeSwitch } from '@aetherui-kit/core/switch';defineAeSwitch();| Name | Type | Default | Description |
|---|---|---|---|
checked |
boolean |
false |
Checked state |
disabled |
boolean |
false |
Disabled state |
name |
string |
'' |
Form field name |
value |
string |
'on' |
Value when checked |
size |
'sm' | 'md' | 'lg' |
'md' |
Size variant |
Events
Section titled “Events”| Name | Detail | Description |
|---|---|---|
ae-switch-change |
{ checked: boolean } |
Fired when toggled |
| Name | Description |
|---|---|
| default | Label text |
CSS Parts
Section titled “CSS Parts”| Name | Description |
|---|---|
base |
Container |
control |
Switch track |
thumb |
Switch thumb |
label |
Label text |
Accessibility
Section titled “Accessibility”- Uses
role="switch"witharia-checked - Keyboard toggling with Space/Enter
- Associated label for screen readers