Ashish Sharma

Segmented Control

Component 1

About

A segmented control / tab-like radio group where a sliding plate animates to the selected option, usable to switch between a small set of views like Day/Week/Month.

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 * as React from "react";
import SegmentedControl from "@/components/ui/segmented-control";

export default function SegmentedControlDemo() {
  const [value, setValue] = React.useState("day");

  return (
    <div className="flex min-h-[200px] w-full items-center justify-center p-8">
      <SegmentedControl
        label="View"
        value={value}
        onValueChange={setValue}
        options={[
          { value: "day", label: "Day" },
          { value: "week", label: "Week" },
          { value: "month", label: "Month" },
        ]}
      />
    </div>
  );
}

More by Ashish Sharma

View all
  • Perspective Gallery

    Perspective Gallery

    149
  • Bento Features

    Bento Features

    27
  • Animated Sidebar

    Animated Sidebar

    25
  • Otp Input

    Otp Input

    25
  • Glow Ring

    Glow Ring

    20
  • Notification Stack

    Notification Stack

    11
  • Expandable Tabs

    Expandable Tabs

    11
  • Voice Orb

    Voice Orb

    8