Özer

Segmented Control

Component 94

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>
  );
}

Dependencies

More by Özer

View all
  • Password Strength

    Password Strength

    1.3K
  • OTP Input

    OTP Input

    799
  • Loading Button

    Loading Button

    599
  • Progress Bar

    Progress Bar

    586
  • Reorder List

    Reorder List

    308
  • Task Steps

    Task Steps

    275
  • Hold to Confirm

    Hold to Confirm

    249
  • Reading Progress

    Reading Progress

    168