About
Single-choice control with a sliding thumb. Keyboard works like a radio group and mirrors in RTL. Two sizes, icons, disabled options and a full-width mode.
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
import * as React from "react";
import {
SegmentedControl,
SegmentedControlItem,
} from "@/components/ui/segmented-control";
export default function SegmentedControlDemo() {
const [value, setValue] = React.useState("day");
return (
<div className="flex min-h-[300px] w-full items-center justify-center p-8">
<SegmentedControl value={value} onValueChange={setValue}>
<SegmentedControlItem value="day">Day</SegmentedControlItem>
<SegmentedControlItem value="week">Week</SegmentedControlItem>
<SegmentedControlItem value="month">Month</SegmentedControlItem>
<SegmentedControlItem value="year">Year</SegmentedControlItem>
</SegmentedControl>
</div>
);
}








