# Split button

One primary native action joined to a keyboard-accessible menu of related alternatives.

Access: pro. Category: Essentials. Kind: primitive.

## When to use

- Use it when a product interface needs one primary native action joined to a keyboard-accessible menu of related alternatives.
- Choose it when the host application can supply the required state and keep business logic outside the presentation component.

## Alternatives

- Choose tidal-button instead when press, loading, success and disabled states is the actual interface need, rather than split button.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Split button

```sh
npx shadcn@latest add @tidal-pro/split-button
```

Stylesheets: `components/ui/tidal.css`, `components/ui/split-button.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/split-button.css";
import{TidalSplitButton}from"./components/ui/split-button";
export default()=><div className="tidal-scope"><TidalSplitButton label={"Demo"} menuLabel={"Demo"} options={[{id:"example",label:"Demo",textValue:"Demo"}]}/></div>;
```

## Structured props

- `TidalSplitButton.label: ReactNode`: Required label value accepted by this exported component.
- `TidalSplitButton.menuLabel: string`: Required menu label value accepted by this exported component.
- `TidalSplitButton.options: ReadonlyArray<TidalSplitButtonOption>`: Required options value accepted by this exported component.
- `TidalSplitButton.contentProps?: ContentProps | undefined`: Optional content props value accepted by this exported component.
- `TidalSplitButton.contentRef?: Ref<HTMLDivElement> | undefined`: Optional content ref value accepted by this exported component.
- `TidalSplitButton.defaultOpen?: boolean | undefined`: Optional default open value accepted by this exported component.
- `TidalSplitButton.dir?: "ltr" | "rtl" | undefined` (default "ltr"): Optional dir value accepted by this exported component.
- `TidalSplitButton.disabled?: boolean | undefined` (default false): Optional disabled value accepted by this exported component.
- `TidalSplitButton.menuDisabled?: boolean | undefined` (default false): Optional menu disabled value accepted by this exported component.
- `TidalSplitButton.onOpenChange?: ((open: boolean) => void) | undefined`: Callback invoked when the open change interaction is proposed.
- `TidalSplitButton.open?: boolean | undefined`: Optional open value accepted by this exported component.
- `TidalSplitButton.primaryLoading?: boolean | undefined` (default false): Optional primary loading value accepted by this exported component.
- `TidalSplitButton.primaryProps?: PrimaryProps | undefined`: Optional primary props value accepted by this exported component.
- `TidalSplitButton.primaryRef?: Ref<HTMLButtonElement> | undefined`: Optional primary ref value accepted by this exported component.
- `TidalSplitButton.theme?: "light" | "dark" | undefined` (default "light"): Optional theme value accepted by this exported component.
- `TidalSplitButton.triggerProps?: TriggerProps | undefined`: Optional trigger props value accepted by this exported component.
- `TidalSplitButton.triggerRef?: Ref<HTMLButtonElement> | undefined`: Optional trigger ref value accepted by this exported component.
- `TidalSplitButton.variant?: "primary" | "secondary" | "ghost" | undefined` (default "primary"): Optional variant value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/split-button.tsx) | [Manifest](https://tidalui.com/examples/split-button.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
"use client";

import "./components/ui/tidal.css";

import { useRef, useState } from "react";

import { Archive, Copy, FileCheck2 } from "lucide-react";

import { TidalSplitButton } from "./components/ui/split-button";

import "./components/ui/split-button.css";

import "./components/ui/dropdown-menu.css";



const tidalExampleStyles = ".tidal-scope .split-demo {\n  container: split-demo / inline-size;\n  display: grid;\n  justify-items: start;\n  width: min(100%, 440px);\n  min-width: 0;\n  gap: 14px;\n  color: var(--t-ink);\n}\n\n.tidal-scope .split-demo-context {\n  display: flex;\n  align-items: baseline;\n  justify-content: space-between;\n  gap: 14px;\n  width: 100%;\n  min-width: 0;\n  padding-bottom: 10px;\n  border-bottom: 1px solid var(--t-border);\n}\n\n.tidal-scope .split-demo-context > span,\n.tidal-scope .split-demo-context > strong,\n.tidal-scope .split-demo-status,\n.tidal-scope .split-demo-note {\n  margin: 0;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .split-demo-context > span {\n  min-width: 0;\n  font-size: 12px;\n  font-weight: 650;\n}\n\n.tidal-scope .split-demo-context > strong {\n  flex: none;\n  color: var(--t-muted);\n  font-size: 11px;\n  font-weight: 560;\n}\n\n.tidal-scope .split-demo .tidal-split-button {\n  max-width: 100%;\n}\n\n.tidal-scope .split-demo-status,\n.tidal-scope .split-demo-note {\n  color: var(--t-muted);\n  font-size: 12px;\n  line-height: 1.55;\n}\n\n.tidal-scope .split-demo-status {\n  min-height: 19px;\n  color: var(--t-ink);\n}\n\n.tidal-scope .split-demo-note {\n  padding-top: 2px;\n  border-top: 1px solid var(--t-border);\n}\n\n@container split-demo (max-width: 300px) {\n  .tidal-scope .split-demo-context {\n    align-items: flex-start;\n    flex-direction: column;\n    gap: 4px;\n  }\n\n  .tidal-scope .split-demo .tidal-split-button {\n    width: 100%;\n  }\n}";

export function SplitButtonDemo({
  theme = "light",
}: {
  theme?: "light" | "dark";
}) {
  const primaryRef = useRef<HTMLButtonElement>(null);
  const triggerRef = useRef<HTMLButtonElement>(null);
  const [revision, setRevision] = useState(3);
  const [archived, setArchived] = useState(false);
  const [status, setStatus] = useState("Revision 3 is ready to save.");

  return (
    <section className="split-demo" aria-label="Split button preview">
      <div className="split-demo-context">
        <span>Project brief</span>
        <strong>Revision {revision}</strong>
      </div>

      <TidalSplitButton
        theme={theme}
        label={archived ? "Restore draft" : "Save draft"}
        menuLabel="More draft actions"
        primaryRef={primaryRef}
        triggerRef={triggerRef}
        primaryProps={{
          onClick: () => {
            if (archived) {
              setArchived(false);
              setStatus("The fictional draft was restored in this preview.");
              return;
            }
            setRevision((current) => current + 1);
            setStatus("A new local revision was saved in this preview.");
          },
        }}
        options={[
          {
            id: "copy",
            textValue: "Save a copy",
            label: "Save a copy",
            description: "Create another local sample revision.",
            icon: <Copy aria-hidden="true" />,
            disabled: archived,
            onSelect: () => {
              setRevision((current) => current + 1);
              setStatus("A sample copy was added locally.");
            },
          },
          {
            id: "ready",
            textValue: "Mark ready",
            label: "Mark ready",
            description: "Update only the preview status.",
            icon: <FileCheck2 aria-hidden="true" />,
            disabled: archived,
            onSelect: () => setStatus("Revision marked ready in this preview."),
          },
          {
            id: "archive",
            textValue: archived ? "Restore draft" : "Archive draft",
            label: archived ? "Restore draft" : "Archive draft",
            description: archived
              ? "Return the sample to active work."
              : "Move the sample out of active work.",
            icon: <Archive aria-hidden="true" />,
            destructive: !archived,
            onSelect: () => {
              setArchived((current) => !current);
              setStatus(
                archived
                  ? "The fictional draft was restored in this preview."
                  : "The fictional draft was archived in this preview.",
              );
            },
          },
        ]}
      />

      <p className="split-demo-status" role="status" aria-live="polite">
        {status}
      </p>
      <p className="split-demo-note">
        Sample data. Changes stay in this preview.
      </p>
    </section>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <SplitButtonDemo />
    </div>
  );
}

```

## Gotchas

- Install the declared registry dependencies and render inside a tidal-scope with the foundation stylesheet loaded.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order.","Arrow-key behavior follows the exported composite-control implementation.","Escape dismisses the open overlay where the underlying primitive supports dismissal."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

label is the primary ReactNode action label. menuLabel names both the separate icon trigger and its menu. options requires unique IDs, plain textValue for typeahead, ReactNode labels, optional descriptions/decorative icons, destructive styling, disabled state, native item props/ref, and onSelect. The primary action and menu trigger expose separate native prop bags and refs; the primary type defaults through TidalButton while the menu trigger is always type=button. disabled affects both controls; primaryLoading affects only the primary action; menuDisabled affects only the menu trigger. Native or aria-disabled=true resolves to actual disabled behavior while explicit false is preserved when enabled. theme/dir apply to the portalled Dropdown menu. open/defaultOpen/onOpenChange expose the Radix root contract. contentProps/contentRef expose menu positioning and the portalled surface. The root forwards remaining native div attributes/ref. Consumers own action effects, accepted state, form submission, navigation, focus after a menu action, requests, data and storage.
