Rebar UI

1.0

imitation

Switch

An instant on and off.

SwitchOn and off
Disabled
Disabled on
Thumb icon
Long label

In context

SettingsEach row is one setting, applied at once

Loading

Switch, loadingWaits for an async change; a rejection reverts
  • Remind me dailyOff by default. One notification a day; tapping it opens Today.

The switch shows a spinner for a second, then settles.

Loading (turning on)
Loading (turning off)
Large
Medium (52 by 32)
Pending change and a permission errorIn context: the second switch reverts when Android refuses

Your Profile

Daily readings reminder

  • Remind me dailyOff by default. One notification a day; tapping it opens Today.
  • Time
    8:00 AM

Your Profile

Daily readings reminder

  • Remind me dailyOff by default. One notification a day; tapping it opens Today.
Notifications are blocked

Allow Athic in Android settings, then try again.

    Sizing tokens

    TokensWidth, height, padding, thumb size and travel, track colours, shadow: --rebar-switch-*.

    Props

    PropTypeRequiredDefault
    thumbIconReactNodeNo—
    loadingboolean | undefinedNo—
    onChange((checked: boolean) => void | Promise<void>) | undefinedNo—
    size"md" | "lg" | undefinedNo—
    asChildboolean | undefinedNo—

    Accessibility

    A real Radix role="switch" button: Space or Enter toggles, aria-checked follows checked. It has no label of its own, so wrap it in a <label> or pass aria-label. Use Switch for a setting that applies at once; a Checkbox for a choice submitted with a form.

    data-rebar-* attributes

    data-rebar-component="switch" on the root; data-rebar-part="thumb" and "thumb-icon"; Radix sets data-state.

    Migrating to Ant Design

    AntD's Switch takes the same checked/onChange shape: a close, low-risk rename.