Overview
The Split Button component combines a primary action button with a dropdown menu of additional actions. It’s ideal for presenting a default action alongside related alternatives.Import
Basic Usage
Properties
Inputs
Text label for the primary action button
Lucide icon name to display on the primary button
Array of menu items for the dropdown menu. Each item can have a label, icon, command, and other properties.
When true, both the primary button and dropdown are disabled
Visual style variantOptions:
'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'help' | 'danger'Size of the buttonOptions:
'sm' | 'md' | 'lg'Alignment of the dropdown menuOptions:
'start' | 'end'Additional CSS classes to apply to the component
Custom background color (CSS color value)
Custom text color (CSS color value)
Size of the icon in pixels
Custom ARIA label for the dropdown menu button
When true, the dropdown closes after selecting a menu item
Outputs
Emitted when the primary action button is clicked
Emitted when the dropdown toggle button is clicked
Emitted when a menu item is clicked. Includes the selected item and original mouse event.
MenuItem Interface
Examples
Basic Split Button
With Icons
Severity Variants
Sizes
Menu Alignment
Custom Colors
Disabled State
With Disabled Items
Keep Menu Open
Accessibility
The Split Button component includes comprehensive accessibility features:- Keyboard Navigation: Full keyboard support for both button and menu
- ARIA Attributes: Proper ARIA roles and labels
- Focus Management: Smart focus handling between button and menu items
- Screen Reader Support: Descriptive labels and states
Keyboard Support
Dropdown Trigger
- Enter/Space: Open menu and focus first item
- ArrowDown: Open menu and focus first item
- ArrowUp: Open menu and focus last item
- Escape: Close menu and return focus to trigger
Menu Items
- ArrowDown: Focus next item
- ArrowUp: Focus previous item
- Home: Focus first item
- End: Focus last item
- Enter/Space: Select item and execute command
- Escape: Close menu and return focus to trigger
- Tab: Close menu and move focus to next element
Behavior
Auto-Close
The dropdown automatically closes when:- A menu item is clicked (if
closeOnItemSelectis true) - User clicks outside the component
- User presses the Escape key
- User presses Tab to move focus away
Focus Management
The component manages focus intelligently:- Opening the menu focuses the first enabled item
- Closing with Escape returns focus to the dropdown trigger
- Arrow keys cycle through enabled items only
- Disabled items are skipped during keyboard navigation
Component Details
- Selector:
magary-split-button - Source:
/home/daytona/workspace/source/projects/ng-magary/src/lib/Button/split-button/split-button.ts - Standalone: Yes
- Change Detection: OnPush
