Toggle Button

Stays visually pressed until clicked again — bind pressed to a RwSignal<bool> for toolbar modes like bold or italic.

The control sets aria-pressed and swaps appearance between subtle and secondary. Label text should communicate both the action and current state (for example, "Bold, on"). For settings that apply immediately, prefer Switch; for grouped exclusive choices, compose multiple toggles manually until a group wrapper ships.

  • Rich text toolbar actions (bold, italic, underline)
  • View mode switches that are not instant settings
  • Binary states where pressed appearance should persist
  • Bind pressed to a boolean signal for two-way toggle state.
  • Optionally pass on_click to react when the pressed state changes.
  • Put label text in children.
Default toggle

Starts unpressed; each click toggles the pressed state and updates aria-pressed.

Starts pressed

Initial pressed state for formatting actions that are already active in the editor.

Click toggles state

Two-way binding keeps the pressed signal in sync as users click the control on and off.

Fires on_click handler

Optional callback runs after each toggle with the new pressed value for app-side reactions.