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
















