docs / core / toggle-chip

ToggleChip

pressable chips for choosing what a view shows, when a checkbox list is too heavy and a dropdown would hide the choices.

intensity · recedesrsc · client

provenance

authored in usva

layer

core / primitives

intensity

recedes · safe anywhere, including dense surfaces

composition

dashboard headers and filter rows, picking visible stats or panelssingle mode where a view must always have one panel selectednot a form field. submitting data is Checkbox or RadioGroupnot navigation between views. that is SegmentedControl or Tabs

a11y

each chip is a button carrying aria-pressed · the group is a fieldset named by ariaLabel or a string label · no roving focus, chips sit in the normal Tab orderjest-axe
live demo · try it out
Visible stats
customize
typemulti-select or one-of-many
labelmono eyebrow before the chips
minmultiple only. floor selection locks
2
maxmultiple only. ceiling selection locks
4
disabledthe fieldset disables every chip
usagecopy
import { ToggleChip, ToggleChipGroup } from "@usva-ui/react/primitives/toggle-chip";

<ToggleChipGroup value={stats} onValueChange={setStats} label="Visible stats" min={2} max={4}>
  <ToggleChip value="grade-avg">Grade avg.</ToggleChip>
  <ToggleChip value="active-courses">Active courses</ToggleChip>
  <ToggleChip value="credits-left">Credits left</ToggleChip>
</ToggleChipGroup>

ToggleChipGroup

proptypedefaultnotes
type"multiple" | "single""multiple"single keeps exactly one chip pressed. the last chip cannot be deselected.
valuestring | string[]the pressed ids. controlled; there is no uncontrolled mode.
onValueChange(value) => voidhands back a string[] in multiple mode, a bare id in single mode.
minnumbermultiple only. selected chips lock once the count falls to it.
maxnumbermultiple only. unselected chips lock once the count reaches it.
labelReactNodemono eyebrow before the chips. names the group when it is a string.
ariaLabelstringnames the group when label is not a string.
disabledbooleanfalsethe fieldset disables every chip at once.

ToggleChip

proptypedefaultnotes
valuestringthe chip's id. must be unique inside the group.
disabledbooleanfalsedisables this chip on top of whatever the group decides.

get it

bun add @usva-ui/reactcopy
usagecopy
import { ToggleChip, ToggleChipGroup } from "@usva-ui/react/primitives/toggle-chip";

<ToggleChipGroup value={stats} onValueChange={setStats} min={2} max={4} ariaLabel="Visible stats">
  <ToggleChip value="grade-avg">Grade avg.</ToggleChip>
  <ToggleChip value="active-courses">Active courses</ToggleChip>
</ToggleChipGroup>