Forms/Toggle

Toggle

A two-state pressable button, like a bold or italic toolbar button. Visually inverts when pressed and exposes its state via aria-pressed.

import { Toggle } from "@animui/ui"

Basic

Variants

Sizes

Disabled

Props

PropTypeDefaultDescription
pressedbooleanControlled pressed state.
defaultPressedbooleanfalseUncontrolled initial pressed state.
onPressedChange(pressed: boolean) => voidCalled when the pressed state changes.
variant"default" | "outline""default"Visual style of the toggle.
size"sm" | "md" | "lg""md"Controls padding and font size.
disabledbooleanfalsePrevents interaction and applies reduced opacity.
childrenReact.ReactNodeContent rendered inside the toggle button.
classNamestringAdditional classes for the button element.

Accessibility

  • Renders as a native <button> with aria-pressed.
  • Toggleable with Space or Enter when focused.
  • Disabled state removes the toggle from the tab order.
© 2026 Steal Shadow. MIT License.Report an issue