About
A pill-shaped single-select control for switching between a small set of options, built as an accessible radiogroup with roving arrow-key focus.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Segmented Control to your project and fits it to your theme.
Code
How Segmented Control is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client";
import SegmentedControl, {
type SegmentedOption,
} from "@/components/ui/segmented-control";
import { useState } from "react";
type Section = "overview" | "activity" | "manage" | "reports";
const options: SegmentedOption<Section>[] = [
{ value: "overview", label: "Overview" },
{ value: "activity", label: "Activity" },
{ value: "manage", label: "Manage" },
{ value: "reports", label: "Reports" },
];
export default function SegmentedControlDemo() {
const [section, setSection] = useState<Section>("overview");
return (
<div className="flex min-h-[200px] w-full items-center justify-center bg-background p-10">
<SegmentedControl
options={options}
value={section}
onValueChange={setSection}
label="Section"
/>
</div>
);
}
















