Skip to main content
Neural UIv2.0.0Documentation
View v1 GitHub

SplitButton

Combine a primary button with a dropdown of secondary actions.

Category
Actions
Import
@neural-ui/core/split-button
Selector
neu-split-button
import { NeuSplitButtonComponent } from '@neural-ui/core/split-button';

Usage

primaryClick runs the main action; actionClick identifies a secondary action by id. actions may include disabled entries or dividers. loading prevents duplicate activation while work is pending. The item Template replaces secondary action content; it does not replace the dropdown control or its keyboard behavior.

Examples

Try this application-owned interaction. Its event handling and initial data are included in Code.

Examples

Events: 0

Try and configure

Change the public options, try the result and inspect the updated template. Code contains the complete executable implementation.

Try and configure

Events: 0

template.html
<neu-split-button
  [actions]="actions()"
  [disabled]="false"
  [loading]="false"
  [size]="'md'"
  [variant]="'solid'"
  [tone]="'brand'"
  (primaryClick)="record('primaryClick')"
  (actionClick)="record('actionClick', $event.id)"
  [actionsAriaLabel]="'Save actions'"
  [label]="'Save'"
  [moreActionsAriaLabel]="'More actions'"
></neu-split-button>

State and events

primaryClick runs the main action; actionClick identifies a secondary action by id. actions may include disabled entries or dividers. loading prevents duplicate activation while work is pending. The item Template replaces secondary action content; it does not replace the dropdown control or its keyboard behavior.

Accessibility and keyboard

Tab reaches the primary action and dropdown trigger. Enter/Space opens the menu; arrows navigate and Escape closes it.

Key
Action
Tab Reach the trigger and available native actions.
Enter Open the action menu from its trigger or activate the focused enabled action.
Space Open the action menu from its trigger or activate the focused enabled action.
Arrow keys Move focus among available menu actions according to its orientation.
Home Focus the first available menu action.
End Focus the last available menu action.
Escape Close the action menu and return focus to the trigger.

API

Inputs, models and Outputs are extracted from the installed Core package. Named public types link to their definitions. Templates below include executable examples.

Inputs

Configure the component with [property]="value". Your application supplies these values; the component does not replace the state you pass in.

Name
Type
Default
Template binding
Description
actionsNeuSplitButtonAction[][][actions]Secondary actions with stable ids, labels and optional disabled/divider flags.
actionsAriaLabelstring'Actions'[actionsAriaLabel]Accessible name of the secondary action menu or its trigger.
disabledbooleanfalse[disabled]Prevents interaction with this control.
labelstring''[label]Visible label naming the field or action.
loadingbooleanfalse[loading]Displays the loading state while the application supplies data.
moreActionsAriaLabelstring'More options'[moreActionsAriaLabel]Accessible name of the secondary action menu or its trigger.
sizeNeuButtonSize'md'[size]Control size. The accepted scale or numeric unit is specified by its type.
toneNeuButtonTone'brand'[tone]Semantic action colour, such as brand, neutral, success, warning or danger.
variantNeuButtonVariant'solid'[variant]Button appearance, such as solid, outline or ghost; consult the type for all supported values.

Outputs

Listen to an event with (event)="handler($event)". The table explains the data your handler receives and how to use it.

Name
Payload
Template binding
Description
actionClickNeuSplitButtonAction(actionClick)="onActionClick($event)"Emits the activated secondary action object.
closedvoid(closed)="onClosed($event)"Reports closure of this component. Consult the payload type for the emitted data.
openedvoid(opened)="onOpened($event)"Reports opening of this component. Consult the payload type for the emitted data.
primaryClickMouseEvent(primaryClick)="onPrimaryClick($event)"Emits the native event for the main button action.

Templates

ng-content projects content into the component. TemplateRef inputs receive a template; ng-template directives identify templates with a typed context. A directive shared by an entrypoint is not necessarily a slot of this component.

Name
Mechanism
Contract
NeuSplitButtonItemDirectiveView example Public template directive (entrypoint)ng-template[neuSplitButtonItem]

Each example demonstrates a different template. Switch between Demo and Code to inspect its implementation, imports and state.

NeuSplitButtonItemDirective

NeuSplitButtonItemDirective

NeuSplitButtonItemDirective

Events: 0

Public Types

Open a type to inspect its definition and interface fields.

Styles and tokens

Use the supported public tokens listed below. Surrounding layout belongs to your application; validate the result in light and dark modes and narrow containers.

Specific tokens

Token
Purpose
State / variant
Default / source
Fallback
--neu-split-button-primary-divider Inherited theme value used by this component Field surface rgba(255, 255, 255, 0.25)Root declarationNo token alias

Shared tokens used

Override these on a local wrapper to affect this example. An override on :root affects other components that use the same token.

Token
Purpose here
Other impact
Default / fallback
--neu-border Normal control and cell borders Shared by other Core consumers; scope the override. rgba(15, 23, 42, 0.08)
--neu-radius Control corner radius Shared by other Core consumers; scope the override. 8px
--neu-surface Main field, header or control surface Shared by other Core consumers; scope the override. #ffffff
--neu-surface-2 Secondary surfaces and alternating rows Shared by other Core consumers; scope the override. #f1f5f9
--neu-text Main text and inherited icon color Shared by other Core consumers; scope the override. #0f172a
--neu-text-disabled Text of disabled controls Shared by other Core consumers; scope the override. #64748b
--neu-font-sans Text typography Shared by other Core consumers; scope the override. 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif
--neu-shadow-lg Surface or overlay elevation Shared by other Core consumers; scope the override. 0 10px 30px rgba(15, 23, 42, 0.1), 0 4px 8px rgba(15, 23, 42, 0.04)