ui-kit0.0

Actions

Toggle & segmented

Pressable toggles and a gliding segmented control.

Segmented control

A radio-like choice between a few views. One highlight glides to the selected option. The arrow keys move and select.

Team plan: $24 / month

When to use

  • SegmentedControl: switching a view or setting, exactly one always selected (billing period, List / Board, Day / Week).
  • Toggle: one on/off state that applies immediately (Bold, Pin, Mute).
  • ToggleGroup: a toolbar of related toggles, one pressed or several (formatting, alignment).
  • Not for navigating between pages (use tabs or links) or for form settings that need Save (use a switch or radio group).

Sizes and icons

Toggle

A button with aria-pressed. ghost is transparent until pressed, outline adds a border. Controlled with pressed, or uncontrolled with defaultPressed.

Toggle group

type="multiple" allows several pressed items, type="single" at most one. The group is one tab stop; arrows move between items.

bold · aligned left

API

Toggle

PropTypeDefaultDescription
pressed / defaultPressedboolean—Pressed state, controlled or initial.
onPressedChange(pressed: boolean) => void—Called when toggled.
variant'ghost' | 'outline''ghost'Visual style.
size'sm' | 'md' | 'lg''md'Height 32 / 36 / 44px.
iconboolean—Square icon-only. Needs aria-label.

ToggleGroup

PropTypeDefaultDescription
type'single' | 'multiple''single'How many items can be pressed.
value / defaultValuestring | string[]—Pressed item value(s); '' means none in single mode.
onValueChange(value) => void—Called when the pressed set changes.
variant / size / disabledsame as Toggle—Applied to every item. Outline joins items into one bar.
orientation'horizontal' | 'vertical''horizontal'Which arrow keys move focus.

SegmentedControl

PropTypeDefaultDescription
value / defaultValuestring—Selected item value.
onValueChange(value: string) => void—Called when the selection changes.
size'sm' | 'md' | 'lg''md'Height 32 / 36 / 44px.
fullWidthboolean—Stretch; items share the width equally.
namestring—Submits the value with a form (hidden input).
disabledboolean—Disable all items; each SegmentedControlItem also takes disabled.

Keyboard

KeyAction
TabInto the group: lands on the selected / pressed item, else the first.
Arrow keys / Home / EndToggle group: move focus. Segmented control: move focus and select.
Space / EnterToggle: press or release the focused item.

Accessibility

  • Toggle and ToggleGroup items are buttons with aria-pressed inside role="group": name the group with aria-label.
  • SegmentedControl is a radiogroup: role="radio" with aria-checked and a roving tabindex (WAI-ARIA radio group).
  • Icon-only items need an aria-label.

Motion

  • The segmented pill glides on the morph spring (about 550ms) and resizes to the new label. It is measured, positioned with CSS variables and does not animate on first render.
  • Toggles press to .97 on the snappy spring; colours cross-fade in 150ms.
  • Reduced motion: the pill jumps, states still change.