Ashish Sharma

Split Button

Buttons

About

A primary action button joined to a dropdown of close alternatives, where picking an option can replace the button's own label.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Split Button to your project and fits it to your theme.

Code

How Split Button is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import SplitButton from "@/components/ui/split-button";
import { GitMerge } from "lucide-react";

const mergeOptions = [
  {
    value: "squash",
    label: "Squash and merge",
    description: "4 commits become one on main",
  },
  {
    value: "merge",
    label: "Create a merge commit",
    description: "Keeps all 4 commits and adds a merge",
  },
  {
    value: "rebase",
    label: "Rebase and merge",
    description: "Unavailable: 2 files conflict with main",
    disabled: true,
  },
];

export default function SplitButtonDemo() {
  return (
    <div className="flex min-h-[320px] w-full items-center justify-center bg-background p-10">
      <SplitButton
        icon={<GitMerge aria-hidden="true" />}
        defaultValue="squash"
        options={mergeOptions}
        onRun={(value: string) => console.log(value)}
      />
    </div>
  );
}

Dependencies

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

More in Buttons

View all
  • Button

    Button

    168
  • Texture Button

    Texture Button

    122
  • HeroUI Button Group

    HeroUI Button Group

    1
  • Button

    Button

    88
  • Native Button

    Native Button

    7
  • Button

    Button

    74
  • Button Group

    Button Group

    1
  • Button

    Button

    21

Explore more

Part of Caliper UI — browse the full library on 21st.dev.