GitHub

/ switch

Switch

@kumiki/components/switch

Compound <Switch.Root> for an on/off setting (role="switch", aria-checked).

This component, layer by layer

Styled, copy-paste presets (preview). Run pnpm kumiki add to drop the source into your project, then edit freely.

Live preview

Live preview…

Install
pnpm add @kumiki/atelier
Track + thumb Switch
<script lang="ts">
  import { Tailwind as Switch } from '@kumiki/atelier/switch';
  let notify = $state<boolean | undefined>(true);
</script>

<label>
  <Switch.Root bind:checked={notify} aria-label="Notifications" />
  <span>Email notifications</span>
</label>

/ accessibility

Accessibility

axe-core — run on every PR (LTR + RTL × every documented state).

Keyboard

KeyEffect
Space, EnterToggles checked state.
TabMove focus.

Test discipline

  • axe-core — run on every PR (LTR + RTL × every documented state).
  • APG keyboard tests — Playwright, hand-written per pattern.
  • VoiceOver / NVDA — Guidepup nightly schedule.
  • Type-level required names — title / aria-label / aria-labelledby.
Read the W3C ARIA APG pattern ↗