Skip to content

Switch

A control that allows users to toggle between checked and unchecked.

Installation

bash
npx @galaxy-stack/nebula-cli@latest add switch
bash
pnpm dlx @galaxy-stack/nebula-cli@latest add switch
bash
yarn dlx @galaxy-stack/nebula-cli@latest add switch
bash
bunx @galaxy-stack/nebula-cli@latest add switch
bash
# If you have installed galaxy-design globally
galaxy-design add switch

API Reference

Props

PropTypeDefaultDescriptionFrameworks
checkedbooleanundefinedControlled checked stateAll
defaultCheckedbooleanfalseUncontrolled initial checked stateAll
onCheckedChange(checked: boolean) => void-Called when checked state changesAll
disabledbooleanfalseDisables the switchAll
requiredbooleanfalseRequires value before form submissionAll
namestring-Name for form submissionAll
valuestring-Value for form submissionAll
classNamestring''CSS class namesReact, React Native
classstring''CSS class namesVue, 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:

PropTypeDefaultDescription
............

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)

License

MIT © 2025 Bùi Trọng Hiếu (kevinbui)

Released under the MIT License.