v0.3.1 StableFoundation ComponentReact 18 & 19Zero Runtime CSS

SegmentedControl

A compact, form-aware single-choice group.

Interactive preview

Billing frequency

Billing: monthly

Usage

import { SegmentedControl } from "@devvy-ui/react";

<SegmentedControl label="Billing" name="billing" defaultValue="monthly" items={[{value:"monthly",label:"Monthly"},{value:"yearly",label:"Yearly"}]} />

API reference

Native HTML attributes, className, style and a forwarded ref are supported. Component-specific props:

PropTypeDefaultDescription
label / itemsReactNode / readonly RadioItem[]requiredGroup legend and options.
value / defaultValue / onValueChangeRadioGroup selection props—Controlled or native initial selection.
name / required / disablednative form attributes—Native radio semantics.

Accessibility & behavior

Platform Behavior & Guidelines

Composes RadioGroup with compact horizontal styling; source mode includes that dependency. Native radios remain focusable and form-aware. Arrow keys follow browser radio behavior, including RTL. This chooses a value; use Tabs for tab panels and links for route navigation.

Source ownership

Run npx @devvy-ui/cli init once in your React project, then add the source:

npx @devvy-ui/cli add segmented-control

Make the source yours.

Start from the canonical implementation used by the package and registry. Change the code, keep the MIT notice, and build the behavior your project needs.

SegmentedControl.tsxREACT / TSX

Edit your own copy. Downloaded source uses your changes; the component preview above uses the shipped version. Run the source installer first to include shared helpers.