Skip to content
kapable

ToggleButton

Actions · 1 export · v0.1.0 · showcase

Independent pressed-state action exposed through a native button and aria-pressed.

Browse 72 component families

ToggleButton renders its initial pressed state on the server, but state changes require the client runtime. This server-rendered page does not imitate client behavior. Open the live playground.

Usage

ToggleButton usage
<ToggleButton defaultPressed>Pin</ToggleButton>

API

ToggleButton API

ToggleButtonProps

A toolbar toggle: a native `<button aria-pressed>` for independent stateful actions (pin, mute, bold). Distinct vocabulary from Switch (form on/off, role=switch) and SegmentedControl (exclusive choice). NOT built on remix/ui/toggle/primitives — that primitive stamps `role="switch"` semantics, the wrong vocabulary here, and flipping one boolean on a native button (click + Space/Enter already browser-owned) is closure logic, not an aria rebuild. Island doctrine for toggling.

ToggleButton props
proptypenotes
children?RemixNode
defaultPressed?boolean
onPressedChange?(pressed: boolean) => voidFires after each flip with the new state.
label?stringAccessible name when children are glyph-only.
size?BtnSize
disabled?boolean
mix?MixInput

More in Actions

More in Actions