Chroma Panel

Search documentation

Find a page or section

SegmentedControl

A segmented set of mutually exclusive options.

Anatomy

import { SegmentedControl } from "chroma-panel";

Only inside a panel

This is one of the parts the built-in modes are made of. It reads the colour through usePanel(), so it only works inside a ChromaPanel — typically in a custom mode. For a picker outside the panel, use the store and hooks.

API reference

Props

PropTypeDefaultDescription
items*SegmentedItem[]The segments, in order. content is what each tab renders.
value*stringId of the selected segment.
onChange*(id: string) => voidFires with the id chosen.
size"md" | "sm"'md''sm' is the compact height, for toolbars inside a panel.
ariaLabel*stringAccessible name for the tablist.
controls(id: string) => stringMaps a segment id to the id of the panel it controls, for aria-controls.
segmentId(id: string) => stringMaps a segment id to the DOM id given to that tab.
disabledbooleanfalseMakes every segment unselectable.
classNamestringClass on the tablist.
tabClassNamestringClass on each tab.