Skip to main content
Urbicon UI
source

Toggle

Accessible on/off switches with labels, sizes, intent-based styling, and micro-interactions.

Push updates instantly
Loading...
Loading syntax highlighting...

01 Examples

Notification Preferences

A realistic settings card with interactive toggles — the canonical pattern for preferences, account settings, and feature flags.

Notification Preferences

Manage how you receive updates

Receive alerts on your device
Weekly summary of your activity
Let others know when you've seen their messages
Loading...
Loading syntax highlighting...

02 Micro-Interactions (Mint)

Mint Presets

Hover over each toggle to see the micro-interaction effect.
Loading...
Loading syntax highlighting...

03 Customization

Gradient Tracks

Override the track slot with custom gradients for brand-specific controls.
Loading...
Loading syntax highlighting...

Dark Mode Switch

A realistic dark mode toggle with icon-like styling.
☀️
🌙
Loading...
Loading syntax highlighting...

Fully Custom (unstyled)

Strip all defaults and rebuild with a monospace terminal aesthetic. Uses data-state for conditional styling.
Loading...
Loading syntax highlighting...

04 Accessibility

Built-in ARIA

Renders with role="switch" and aria-checked that updates automatically. Labels are associated via id, and helper text is linked through aria-describedby.

Keyboard

Tab to focus, Space to toggle. The focus ring uses peer-focus-visible: to relay the hidden input's focus state onto the visible track.

Reduced Motion

The thumb slide animation and all Mint effects are suppressed when prefers-reduced-motion is enabled.

Don't wrap with <label>

Toggle already renders a correctly associated <label> internally. Wrapping it in another <label> creates nested label semantics — clicks on the outer label may not toggle the switch reliably across browsers, and screen readers can announce the label twice.

Don't

<label>
  Notifications
  <Toggle />
</label>

Do

<Toggle label="Notifications"
        helper="Email + push" />

05 API Reference

21 props
21 props

No matching properties

No matching properties

06 Installation

Import

Loading...
Loading syntax highlighting...