Split Button A split button groups multiple related actions.

A split button is a way of grouping related actions. One action will be visible by default; the others will be hidden within a dropdown menu.

Table of contents


Usage guidelines

When to use
  • Use a split button when there are multiple, related, branching actions of equal hierarchy. These actions should be of equal hierarchical weight. For instance, the "New story" split button in the editor's dashboard controls which story type will be created; the default story type isn't more important than the mapstack story type, just more common.
  • Like the primary variant of buttons which they resemble, split buttons should be used sparingly, to either begin or end an entire workflow.
How to use
  • Carefully consider which action should be featured most prominently as the default action.
  • As the editor's "New story" split button does, you could use the active to programmatically change what appears as the default action based on certain conditions, such as whether that action was the last one selected.


Attributes

An asterisk next to a value denotes that it is the default value for that attribute. Unless noted otherwise, attributes should be added to the component element directly. Boolean attributes work based on their presence or absence from the component.

<res-component booleanAttribute stringAttribute="parameter">    
  <child-element></child-element>
</res-component>
AttributeTypeDescription
iconstringName of res-icon to render within button (and as mobile button)
mobilebooleanSets whether mobile styles are used
disabledbooleanSet initial state to disabled
activebooleanPlaced on the li you'd like to be the main action (otherwise defaults to the first 'li')

Notes

Depends on:
Required DOM

Without these, the component will throw an error on render.

  • <ul|ol> - List of links

History

VersionNote
0.25.0Use the original active target node to preserve click events.
0.16.1Prevent res-split-button instances from rendering twice.
0.12.0Apply new spacing scale. Change res-icon size names from medium to large. New name, same size.
0.11.10Add additional positioning calculation on toggle to prevent misalignment.
0.11.0Tweaks to accommodate new icon set.
0.10.1Make tap target larger on mobile design
0.10.0Color update, and added transparent border between action and toggle
0.9.0Design tweak to flatten the corners of the dropdown
0.7.4Add disabled state
0.7.2Initial build to spec.