SplitButton ============ A component for displaying a button with a main action plus a secondary set of actions behind a menu toggle. ## How to use: ```jsx import SplitButton from 'components/split-button'; render: function() { return (
alert( 'Primary Main Action clicked' ) } controls={ [ { label: 'Up', onClick: () => alert( 'Primary Up clicked' ), }, { label: 'Right', onClick: () => alert( 'Primary Right clicked' ), }, { label: 'Down', icon: , onClick: () => alert( 'Primary Down clicked' ), }, { label: 'Left', icon: , onClick: () => alert( 'Primary Left clicked' ), }, ] } /> } menuLabel="Select an action" onClick={ () => alert( 'Icon Only Action clicked' ) } controls={ [ { label: 'Up', icon: , onClick: () => alert( 'Icon Only Up clicked' ), }, { label: 'Right', onClick: () => alert( 'Icon Only Right clicked' ), }, { label: 'Down', icon: , onClick: () => alert( 'Icon Only Down clicked' ), }, { icon: , onClick: () => alert( 'Icon Only Left clicked' ), }, ] } />
); } ``` ## Props * `isPrimary`: Default false. Whether the button is styled as a primary button. * `mainIcon`: Icon for the main button. * `mainLabel`: Label for the main button. * `onClick`: Function to activate when the the main button is clicked. * `menuLabel`: Label to display for the menu of actions, used as a heading on the mobile popover and for accessible text. * `controls`: An array of additional actions. Accepts additional icon, label, and onClick props. * `className`: Additional CSS classes.