CarsXE

Search docs

Search pages, components, and skills.

Split Button

A primary action joined to a menu of related ones. The left button behaves like any Button and keeps its props; items describes the menu, including separators, links, destructive entries, and one level of submenu. loading shows a spinner and disables both halves at once.

Installation

Import from the package. Do not run shadcn add in your app.

tsx
import { SplitButton } from "@carsxe/design-system/components/split-button"

Usage

tsx
import { SplitButton } from "@carsxe/design-system/components/split-button"

<SplitButton
  items={[
    { id: "email", label: "Email report", onSelect: emailReport },
    { separator: true },
    { id: "delete", label: "Delete report", destructive: true, onSelect: remove },
  ]}
  onClick={orderReport}
>
  Order report
</SplitButton>

Variants

Sizes

Submenus, links, and disabled items

Loading and disabled

API Reference

PropTypeDefault
itemsSplitButtonItem[]—
loadingbooleanfalse
menuLabelstring"More options"
contentPropsReact.ComponentProps<typeof DropdownMenuContent>—
variantButton variant"default"
sizeButton size"default"
onClick(event) => void—
disabledbooleanfalse