Switch
A control that allows users to toggle between checked and unchecked.
Installation
bash
npx @galaxy-stack/nebula-cli@latest add switchbash
pnpm dlx @galaxy-stack/nebula-cli@latest add switchbash
yarn dlx @galaxy-stack/nebula-cli@latest add switchbash
bunx @galaxy-stack/nebula-cli@latest add switchbash
# If you have installed galaxy-design globally
galaxy-design add switchAPI Reference
Props
| Prop | Type | Default | Description | Frameworks |
|---|---|---|---|---|
checked | boolean | undefined | Controlled checked state | All |
defaultChecked | boolean | false | Uncontrolled initial checked state | All |
onCheckedChange | (checked: boolean) => void | - | Called when checked state changes | All |
disabled | boolean | false | Disables the switch | All |
required | boolean | false | Requires value before form submission | All |
name | string | - | Name for form submission | All |
value | string | - | Value for form submission | All |
className | string | '' | CSS class names | React, React Native |
class | string | '' | CSS class names | Vue, Angular, Flutter |
Usage
vue
<Switch v-model:checked="enabled" />tsx
<Switch checked={enabled} onCheckedChange={setEnabled} />html
<ui-switch [(checked)]="enabled" />Bùi Trọng Hiếu (kevinbui) - MIT © 2025
API Reference
Props
This component accepts the following props:
| Prop | Type | Default | Description |
|---|---|---|---|
| ... | ... | ... | ... |
Accessibility
- Keyboard Navigation: [TODO]
- Screen Reader: [TODO]
- Focus Management: [TODO]
- WCAG Compliance: WCAG 2.1 Level AA compliant
Author
Bùi Trọng Hiếu (kevinbui)
- GitHub: @buikevin
- Email: kevinbui210191@gmail.com
License
MIT © 2025 Bùi Trọng Hiếu (kevinbui)
