Lucent UI
← ToggleSegmentedControlText →
✦ LLM-ready

SegmentedControl

atom

Pill-style toggle group with an elevation-aware sliding indicator. Uses getBoundingClientRect with ResizeObserver for pixel-perfect positioning. Zero-padding track with 3px inset indicator. Focus ring only on keyboard navigation (:focus-visible).

"Add a SegmentedControl from lucent-ui with three options for switching between view modes. Use defaultValue."

Usage

React / JSX
import { SegmentedControl } from 'lucent-ui'

<SegmentedControl size="md"
  options={[
    { value: "grid", label: "Grid" },
    { value: "list", label: "List" },
    { value: "board", label: "Board" },
  ]}
  defaultValue="grid" />

Installation

pnpm add lucent-ui

API Reference

SegmentedControl props — * required

PropTypeDefaultDescription
options*{ value: string; label: string }[]—The available options.
defaultValuestring—Initially selected value (uncontrolled).
valuestring—Selected value (controlled).
onChange(value: string) => void—Callback fired when the selection changes.
size"sm" | "md" | "lg""md"Controls the height and font size of the control.
fullWidthbooleanfalseStretches the control to fill its container width.
disabledbooleanfalseDisables all options.