bmates-uiBMates UI
Latest
/Components

Switch

A control for immediately enabling or disabling a setting.

A control for immediately enabling or disabling a setting.

Import

import { Switch } from 'bmates-ui';

Basic usage

The example below mirrors the primary Storybook composition and can be used as a starting point.

<Switch defaultChecked aria-label="Enable notifications" />

Preview

Switch

Prop previews

The examples below isolate the props that change visual output or interaction.

Variants

Variants

Sizes

Sizes

States

States

Component API

checked

Controlled checked state.

onCheckedChange

Called when the state changes.

variant

Track color.

size

Switch size.

label

Text rendered beside the switch.

align

Vertical alignment.

disabled

Prevents interaction.

defaultChecked

Initial checked state in uncontrolled mode.

Usage notes

  • Every component in the table is exported from bmates-ui.
  • Unless noted otherwise, a component also accepts the standard props of its underlying HTML element.
  • For application-owned state, use a controlled value and its change handler instead of only a default* prop.