Skip to content
v0.2.10

SegmentedControl

A compact single-value choice with native radio semantics and a shared inset surface.

Preview
Time range

Use SegmentedControl

SegmentedControl is a named export of @flood-md/react. Connect the package once, then import what you use.

First time here? Connect Flood
Example import style
segmented-control.tsxTSX
"use client";

import { FloodRoot, SegmentedControl } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <SegmentedControl label="Time range" name="period" defaultValue="day" options={[{value: "day", label: "Day"}, {value: "week", label: "Week"}, {value: "month", label: "Month"}]} />
    </FloodRoot>
  );
}

Design notes

  • Uses original RadioGroup behavior and native inputs.
  • Arrow keys move focus and select; Home/End select endpoints, skipping disabled segments. Selecting the current value does not clear it.
  • Native name/form/required, reset and controlled values are preserved. Use actual tabs for tab panels, ToggleGroup for optional pressed actions.

API reference

PropValuesDefault
legendSize · 0.2.10"label" | "section"—
hideLabel · 0.2.3boolean—
hintReactNode—
errorReactNode—
messageReactNode—
status"error" | "warning" | "success" | "info"—
namestringRequired
valuestring—
defaultValuestring—
onValueChange(value: string) => void—
orientation"vertical" | "horizontal""horizontal"
requiredboolean—
labelstringRequired
optionsreadonly ToggleOption[]Required
controlSize"sm" | "md" | "lg" | "xl""md"
iconOnlybooleanfalse
fullWidthbooleanfalse
Native HTML propsOmit<Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, "children" | "defaultValue" | "role">, "legend" | "options">Forwarded
View TypeScript source