Skip to main content
A two-state button that can be on or off.

Import

Basic Usage

Key Features

  • Two-state button (pressed/unpressed)
  • Controlled and uncontrolled modes
  • Works within Toggle Group
  • Accessible with proper ARIA attributes
  • Custom render props

Key Props

pressed

Type: boolean Whether the toggle button is currently pressed. Use with onPressedChange for controlled mode.

defaultPressed

Type: boolean Default: false Whether the toggle button is initially pressed. Use for uncontrolled mode.

onPressedChange

Type: (pressed: boolean, eventDetails: ChangeEventDetails) => void Callback fired when the pressed state is changed.

disabled

Type: boolean Default: false Whether the component should ignore user interaction.

value

Type: string A unique string that identifies the toggle when used inside a toggle group.

Styling

Common Patterns

Icon Toggle

Text Formatting Toggles

With Tooltip

Color Picker Toggle