kevingirelli

Segmented Control

Pricing

About

A pill-shaped switch between two or more options with a thumb that slides to the active choice, like "Monthly | Yearly" billing toggles or filter tabs.

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 {
  SegmentedControl,
  SegmentedControlItem,
} from "@/components/ui/segmented-control";
import { useState } from "react";

export default function SegmentedControlDemo() {
  const [billing, setBilling] = useState("monthly");

  return (
    <div className="flex min-h-[220px] w-full items-center justify-center bg-background p-10">
      <div className="flex flex-col items-center gap-3">
        <SegmentedControl
          aria-label="Billing period"
          value={billing}
          onValueChange={setBilling}
        >
          <SegmentedControlItem value="monthly">Monthly</SegmentedControlItem>
          <SegmentedControlItem value="yearly">
            Yearly, two months free
          </SegmentedControlItem>
        </SegmentedControl>
        <p className="text-sm text-muted-foreground">
          {billing === "monthly" ? "Billed every month." : "Billed every year."}
        </p>
      </div>
    </div>
  );
}

Dependencies

More by kevingirelli

View all
  • Aurora

    Aurora

    166
  • QR Code

    QR Code

    140
  • FAQ Section

    FAQ Section

    98
  • Animated Border

    Animated Border

    88
  • Warp Gradient

    Warp Gradient

    71
  • Corner Frame

    Corner Frame

    71
  • Wave Text

    Wave Text

    63
  • Spotlight

    Spotlight

    52

More in Pricing

View all
  • Pricing Section

    Pricing Section

    733
  • Executive Pricing Plan

    Executive Pricing Plan

    20
  • Pricing Section 1

    Pricing Section 1

    109
  • Single Pricing Card

    Single Pricing Card

    829
  • Review Stack Pricing

    Review Stack Pricing

    11
  • Toggleable Add-on Pricing

    Toggleable Add-on Pricing

    229
  • Pricing Card

    Pricing Card

    409
  • Toggle Pricing Cards

    Toggle Pricing Cards

    112