tigran tumasov

Split Button

Buttons 16

About

A button that offers a primary interaction coupled with a dropdown menu offering additional actions.

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

import { SplitButton, SplitButtonMenuItem } from "@/components/ui/split-button";

export default function MenuAlignmentDemo() {
  return (
        <div className="flex gap-4">
          <SplitButton
            buttonProps={{
              onClick: () => {
                alert("Clicked Saved");
              }
            }}
            menuButtonLabel="Select save method"
            menuItems={
              <>
                <SplitButtonMenuItem
                  description="Save changes"
                  menuItemProps={{
                    onClick: () => {
                      alert("Clicked Save");
                    }
                  }}
                  title="Save"
                />
                <SplitButtonMenuItem
                  description="Save changes and create a new production deployment"
                  menuItemProps={{
                    onClick: () => {
                      alert("Clicked Save + Redeploy");
                    }
                  }}
                  title="Save + Redeploy"
                />
              </>
            }
            menuProps={{ width: 264 }}
          >
            Save
          </SplitButton>

          <SplitButton
            buttonProps={{
              onClick: () => {
                alert("Clicked Saved");
              }
            }}
            menuAlignment="bottom-end"
            menuButtonLabel="Select save method"
            menuItems={
              <>
                <SplitButtonMenuItem
                  description="Save changes"
                  menuItemProps={{
                    onClick: () => {
                      alert("Clicked Save");
                    }
                  }}
                  title="Save"
                />
                <SplitButtonMenuItem
                  description="Save changes and create a new production deployment"
                  menuItemProps={{
                    onClick: () => {
                      alert("Clicked Save + Redeploy");
                    }
                  }}
                  title="Save + Redeploy"
                />
              </>
            }
            menuProps={{ width: 264 }}
          >
            Save
          </SplitButton>
        </div>
  );
}

Dependencies

More by tigran tumasov

View all
  • Product Hunt Badge

    Product Hunt Badge

    1.9K
  • Book

    Book

    189
  • Calendar

    Calendar

    157
  • Theme Switcher

    Theme Switcher

    142
  • Table

    Table

    125
  • Snippet

    Snippet

    125
  • Toggle

    Toggle

    100
  • Feedback

    Feedback

    95

More in Buttons

View all
  • Button

    Button

    37
  • Button

    Button

    20
  • Texture Button

    Texture Button

    113
  • Icon Label Subtext Button

    Icon Label Subtext Button

    68
  • Astryx Chat Send Button

    Astryx Chat Send Button

    5
  • Button

    Button

    16
  • Minimal Button

    Minimal Button

    15
  • Button

    Button

    146