Rebar UI

1.0

imitation

Toggle

A button that stays pressed or not.

Text styleEach button keeps its own pressed state
Pressed
Disabled
Sizes

In context

Project headerA Watch toggle beside the primary action
Harbour rebrandDue 24 Oct

You get an update when tasks move.

Props

PropTypeRequiredDefault
pressedboolean | undefinedNo—
defaultPressedboolean | undefinedNofalse
onPressedChange((pressed: boolean) => void) | undefinedNo—
size"sm" | "md" | "lg" | undefinedNomd
bionicboolean | undefinedNo—
bionicOptionsBionicOptions | undefinedNo—

Icon-only usage needs an aria-label

Same convention as Button: if children is icon-only with no visible text, pass an explicit aria-label yourself — Toggle has no built-in fallback label.

data-rebar-* attributes

data-rebar-component="toggle", data-rebar-pressed (boolean), data-rebar-size.

Migrating to Ant Design

Not codemod-covered — AntD has no direct single-toggle-button primitive of its own (its closest analog is a plain Button with type="primary" conditionally applied by hand). On migration, a Toggle becomes a Button whose type prop is computed from the pressed state.