Skip to main content

ButtonGroup

ButtonGroup is used to display multiple buttons in a layout that is contextual based on the screen width or parent component. When there is more than one secondary action, they get collapsed.

string

Label for the button group that describes the content of the group for screen reader users to understand what's included.

string

A unique identifier for the element.

Was this section helpful?

HTMLElement

The primary action to perform, provided as a button type element.

HTMLElement

The secondary actions to perform, provided as button type elements.

Was this section helpful?

Basic ButtonGroup

Preact

import '@shopify/ui-extensions/preact';
import {render} from 'preact';

export default async () => {
render(<Extension />, document.body);
};

function Extension() {
return (
<s-button-group accessibilityLabel="Order actions">
<s-button slot="primary-action" variant="primary">
Pay now
</s-button>
<s-button slot="secondary-actions" variant="secondary">
Edit order
</s-button>
<s-button slot="secondary-actions" variant="secondary">
Cancel order
</s-button>
</s-button-group>
);
}

Preview

An example of the ButtonGroup component shows a primary action and multiple collapsed secondary actions.