Split Button
<dsx-split-button> — Split Button
Section titled “<dsx-split-button> — Split Button”Primary action button paired with a lightweight dropdown of secondary actions.
Live Preview
Import
Section titled “Import”import '@bnotk/dsx/components/split-button.js';<dsx-split-button label="Save" variant="primary"> <dsx-split-option value="draft">Save draft</dsx-split-option> <dsx-split-option value="copy">Save as copy</dsx-split-option></dsx-split-button>Elements
Section titled “Elements”<dsx-split-button>
Section titled “<dsx-split-button>”Main split-button wrapper with a primary button, a toggle button, and a dropdown menu.
Properties
Section titled “Properties”| Property | Type | Default | Description |
|---|---|---|---|
| label | string | ” | Text label for the primary action button. |
| variant | ’primary’ | ‘secondary' | 'primary’ | Switches between filled and outlined visual treatments. |
| disabled | boolean | false | Disables both button segments and closes pointer interaction. |
Methods
Section titled “Methods”None.
Events
Section titled “Events”| Event | Detail | Description |
|---|---|---|
| dsx-click | — | Bubbles/composed when the primary action button is clicked. |
| dsx-option-select | { value: string | null } | Bubbles/composed when a dsx-split-option is chosen. |
| Slot | Description |
|---|---|
| default | One or more <dsx-split-option> children rendered inside the dropdown menu. |
CSS Parts
Section titled “CSS Parts”This element does not expose shadow parts.
- Opening the dropdown attaches a one-shot
documentclick listener after the current task so outside clicks close the menu. - The default slot has a click handler that resolves the nearest
dsx-split-optionwithclosest().
<dsx-split-option>
Section titled “<dsx-split-option>”Simple block option used inside the split button dropdown.
Properties
Section titled “Properties”| Property | Type | Default | Description |
|---|---|---|---|
| value | string | ” | Value returned in the dsx-option-select event detail. |
Methods
Section titled “Methods”None.
Events
Section titled “Events”None.
| Slot | Description |
|---|---|
| default | Visible option label/content. |
CSS Parts
Section titled “CSS Parts”This element does not expose shadow parts.
- The option itself does not dispatch events; the parent split button handles selection.
Behavior Notes
Section titled “Behavior Notes”- The host is
inline-flexandposition: relativeso the dropdown can be absolutely positioned to the right edge. - Primary and toggle segments share a border radius split across left/right corners.
- The toggle button exposes
aria-haspopup="true"and mirrors the_openstate througharia-expanded.
Styling Notes
Section titled “Styling Notes”- Primary variant uses
--ds2-color-main/--ds2-color-main-darkwith white text. - Secondary variant uses white background, inset border, and the main color for text and separator.
- Dropdown surface uses
--ds2-color-white,--ds2-color-grey-2, and--ds2-shadow-md.