Buttons

Split button

A main action joined to a menu of related ones: press the left part to act, the arrow for the alternatives.

Installation

npx sinaui add split-button

Examples

Save, or save another way

Put the most common action on the left; the menu holds its variations.

<script lang="ts">
	import SplitButton from '#lib/ui/SplitButton.svelte';
	import * as Dropdown from '#lib/ui/dropdown/index.js';

	let status = $state('');
</script>

<SplitButton onclick={() => (status = 'Translation saved.')}>
	Save
	{#snippet menu()}
		<Dropdown.Item onselect={() => (status = 'Saved as a new copy.')}>Save as copy</Dropdown.Item>
		<Dropdown.Item onselect={() => (status = 'Saved and sent to Córdoba.')}>
			Save and send to Córdoba
		</Dropdown.Item>
	{/snippet}
</SplitButton>
<p class="status" role="status">{status}</p>

<style>
	.status {
		min-block-size: 1.5em;
		margin: 0;
		color: var(--ui-muted);
	}
</style>

Secondary

<script lang="ts">
	import SplitButton from '#lib/ui/SplitButton.svelte';
	import * as Dropdown from '#lib/ui/dropdown/index.js';

	let status = $state('');
</script>

<SplitButton
	variant="secondary"
	menuLabel="More ways to borrow"
	onclick={() => (status = 'Borrowed for two weeks.')}
>
	Borrow
	{#snippet menu()}
		<Dropdown.Item onselect={() => (status = 'Reserved for the reading room.')}>
			Read in the library
		</Dropdown.Item>
		<Dropdown.Item onselect={() => (status = 'A scribe will make you a copy.')}>
			Request a copy
		</Dropdown.Item>
	{/snippet}
</SplitButton>
<p class="status" role="status">{status}</p>

<style>
	.status {
		min-block-size: 1.5em;
		margin: 0;
		color: var(--ui-muted);
	}
</style>

Props

PropTypeDefault
variant'primary' | 'secondary''primary'
size'sm' | 'md' | 'lg''md'
onclickthe main action
menuSnippet of Dropdown.Item (required)
menuLabelstring: the arrow's name'More options'
disabledbooleanfalse

Keyboard

KeyDoes
TabMoves between the action and the arrow
Enter SpaceRuns the action, or opens the menu on the arrow
↓Opens the menu from either part
EscapeCloses the menu, back on the arrow

Accessibility

  • The two parts are separate buttons in one group; the arrow is a menu button named by menuLabel.
  • The menu follows the Dropdown: arrow keys, typeahead, and focus returns to the arrow on close.
  • With reduced motion, the arrow flips without turning.
Introduction
Theming
Changelog
Button
Action button
Confirm button
Copy button
Hold to confirm
Split button
Calendar
Checkbox
Color picker
Combobox
Date picker
Date range picker
File drop
Form
Input
Mention input
Multi select
Number field
OTP input
Password input
Phone input
Radio cards
Radio group
Rich text editor
Search field
Segmented control
Select
Signature pad
Slider
Switch
Tag input
Upload
Wheel picker
Textarea
Time field
Toggle group
Toolbar
Alert dialog
Command palette
Context menu
Dialog
Drawer
Dropdown
Hover card
Popover
Tooltip
Announcement bar
Alert
Empty state
Meter
Progress
Rolling number
Skeleton
Spinner
Toast
Avatar
Avatar group
Badge
Card
Carousel
Chart
Chat
Code block
Data table
Folder
Kbd
Mind map
Resizable panels
Scroll area
Separator
Sortable
Table
Tag group
Virtual list
Audio player
Image
Image compare
Video
Visualizer
Breadcrumb
File tree
Menubar
Navigation menu
Pagination
Sidebar layout
Stepper
Tabs
Alarm clock
Clock
Dynamic island
Fluid orb
Hourglass
Stopwatch
Timer
AI chat
AI media
Auth
Board
Booking
Dashboard
File explorer
Messaging
Notifications
Settings
Team
Overview
Pricing
Agent chat
Calendar
Voice agent
Mail inbox
CMS
Blog
Marketing site
E-commerce
AI agents
SaaS landing page
SaaS app
Accordion
Dark theme
Light theme