Inherits size, variant, and surface from a parent PixelToggleGroup
Cyan tone pressed state with surface-aware borders, radius, and transitions
Renders as role="radio" with aria-checked inside a single-select group, aria-pressed otherwise
Registers with the group for roving-tabindex keyboard navigation
Status
stable
Category
forms
Since
v1.9.0
API
import { PixelToggle } from '@pxlkit/ui-kit';
Prop
Type
Default
Description
value* (required)
string
—
Identifies the toggle within its group; also exposed as data-pxl-toggle-value.
pressed
boolean
—
Standalone (uncontrolled) toggle: pressed state.
onPressedChange
(next: boolean) => void
—
Standalone (uncontrolled) toggle: notified on press change.
surface
'pixel' | 'linear'
—
Surface override; defaults to the group's, then to the nearest provider.
Also takes the native attributes and event handlers of <button> (ButtonHTMLAttributes<HTMLButtonElement>).
ref points to <button>.
Accessibility
WCAG target: 2.1 AA
button
Standalone toggle exposes aria-pressed reflecting the boolean state. When wrapped by a single-select PixelToggleGroup the role is overridden to "radio" with aria-checked so screen readers announce "one of N" semantics. Data attributes data-state and data-pxl-toggle-value support styling and testing hooks.
Keyboard
Key
Action
When
Space
Toggles the pressed state (native button activation).
—
Enter
Toggles the pressed state (native button activation).
—
ArrowRight / ArrowDown
Moves focus to the next item.
Inside a PixelToggleGroup with rovingFocus enabled.
ArrowLeft / ArrowUp
Moves focus to the previous item.
Inside a PixelToggleGroup with rovingFocus enabled.
Home / End
Moves focus to the first or last item.
Inside a PixelToggleGroup with rovingFocus enabled.