ui · Primitive

SplitButton

@devalok/shilp-sutra/uiView in Storybook
Live preview coming

Hand-curated previews ship in rolling waves. See it live in Storybook →

Reference

A compound button that combines a primary action with a dropdown trigger, rendered as a single visual unit [Action | ▼].

Import

import { SplitButton } from '@devalok/shilp-sutra'

Usage

<SplitButton onClick={handleSave} dropdownContent={<SaveOptions />}>
  Save
</SplitButton>

Props

PropTypeDefaultDescription
childrenReactNodePrimary action content (left side)
onClick(e) => voidPrimary click handler
dropdownContentReactNodeContent rendered inside floating dropdown
variant'solid' | 'soft' | 'outline''solid'Visual style
color'accent' | 'error' | 'success' | 'warning' | 'neutral''accent'Color scheme
size'xs' | 'sm' | 'md' | 'icon-xs' | 'icon-sm' | 'icon-md''md'Size
triggerSide'left' | 'right''right'Which side the dropdown chevron sits on
triggerWidthnumber | stringautoCustom width for the trigger half
placementPlacement'top-end'Floating UI placement for dropdown
disabledbooleanfalseDisable both halves
openbooleanControlled open state
onOpenChange(open: boolean) => voidOpen state callback
dropdownLabelstring'More options'aria-label for trigger
dropdownIconReactNodechevron-downCustom trigger icon

Composability

Gotchas

  • Always provide dropdownLabel (aria-label on the chevron trigger) — defaults to "More options" but context-specific labels are better
  • triggerSide="left" flips the chevron to the left — rare, but useful for RTL layouts or when the primary action is the secondary emphasis

Changes

v0.33.0

  • Added Initial release