Componentform0.91 KB gzipZero dependencies
Split Button
Dual-action button with primary click trigger and dropdown secondary actions.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add split-buttonOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { SplitButton } from "@/components/ui/split-button"; <SplitButton label="Print Stub" options={[{ id: "pdf", label: "Export PDF" }]} />Source code
split-button.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxsplit-button.tsx122 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface SplitButtonOption { id: string; label: string; shortcut?: string; disabled?: boolean;} export interface SplitButtonProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onClick"> { label: string; options: SplitButtonOption[]; onPrimaryClick?: () => void; onSelectOption?: (option: SplitButtonOption) => void; variant?: "default" | "accent" | "outline";Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { SplitButton } from "@/components/ui/split-button"; <SplitButton />| Prop | Type | Description |
|---|---|---|
| label | string | Primary button label |
| options | SplitButtonOption[] | List of dropdown options |
| onPrimaryClick | () => void | Callback when primary button clicked |
| onSelectOption | (option: SplitButtonOption) => void | Callback when menu option selected |
| variant | "default" | "accent" | "outline" | Visual variant |
| size | "sm" | "md" | "lg" | Component size preset. (Default: "md") |
| disabled | boolean | Disables interaction and applies disabled styling. (Default: false) |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |