Black Friday: 30% off Pro

Get 30% off

Updated

Split Button

Preview

Customize

Solid
Medium
End
Below
Radius12px
Stagger0.030s

Installation

npx shadcn@latest add https://uibrik.com/r/split-button.json
Adds the files to components/uibrik/split-button and installs @tabler/icons-react, motion and react-use-measure. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/split-button.

Usage

import { SplitButton } from "@/components/uibrik/split-button/split-button";​const options = ["Merge pull request", "Squash and merge", "Rebase and merge"];​<SplitButton  options={options}  variant="solid"  size="md"  align="end"  side="bottom"  radius={12}  stagger={0.03}  defaultIndex={0}  onAction={(option, index) => {}}  onSelect={(option, index) => {}}/>

Where to use Split Button

  • Save options

    A primary button with alternatives like save as draft keeps the main action prominent.

  • Deploy and merge

    The chosen action rolling into the main label remembers the user's preference.

  • Export formats

    PDF, CSV and PNG options fit under one export button.

    Pairs with Dropdown Menu

Props

SplitButton
options
Type string[]
["Merge pull request","Squash and merge","Rebase and merge"]
Actions the main button can run.
variant
Type "solid" | "soft" | "outline"
"solid"
Primary, or a quieter look for secondary actions.
size
Type "sm" | "md" | "lg"
"md"
Height, padding and text size.
align
Type "end" | "start"
"end"
Which edge of the button the menu lines up with.
side
Type "bottom" | "top"
"bottom"
Open the menu below the button, or above it (e.g. in a footer).
radius
Type number
12
Corner radius.
stagger
Type number
0.03
Delay between menu items as they unfold.
defaultIndex
Type number
0
Index of the option chosen at first.
onAction
Type (option: string, index: number) => void
–
Called with the chosen option when the main button is pressed.
onSelect
Type (option: string, index: number) => void
–
Called when a different option is chosen from the menu.
className
Type string
–
Classes for the wrapper.