About
An accessible segmented control (radio group) with an animated sliding thumb, keyboard arrow navigation, and controlled or uncontrolled selection for switching between a small set of options.
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 } from "@/components/ui/segmented-control";
import { useState } from "react";
const RANGES = [
{ value: "day", label: "Day" },
{ value: "week", label: "Week" },
{ value: "month", label: "Month" },
{ value: "quarter", label: "Quarter" },
];
export default function SegmentedControlDemo() {
const [range, setRange] = useState("day");
return (
<div className="flex w-full justify-center">
<SegmentedControl
label="Report range"
options={RANGES}
value={range}
onValueChange={setRange}
/>
</div>
);
}








