Skip to content

ActionButtonGroup

Use ActionButtonGroup to group related actions into a single control where a shopper selects one option at a time. Pass ActionButton elements as children, each with a value, and the group tracks which one is active.

The SDK ActionButtonGroup showing related actions with one selected.
import { ActionButtonGroup } from '/@dropins/tools/components.js';
PropTypeReq?Description
variant'primary' | 'secondary'NoChange the group style. Defaults to primary.
activeOptionstringNoThe value of the option that starts selected.
disabledbooleanNoDisable the whole group. Defaults to false.
dividersbooleanNoShow dividers between options. Defaults to true.
childrenVNode<ActionButtonProps>[] | VNode<ActionButtonProps>YesThe ActionButton options in the group, each with a value.
handleSelect(value: string) => voidNoCallback for when an option is selected.

ActionButtonGroup also accepts standard <div> HTML attributes (for example, className and aria-label).

Render a group of two options and handle the selection.

import { ActionButtonGroup, ActionButton, provider } from '/@dropins/tools/components.js';
import { h } from '/@dropins/tools/preact.js';
await provider.render(ActionButtonGroup, {
variant: 'primary',
activeOption: 'grid',
handleSelect: (value) => yourApplyLayout(value),
children: [
h(ActionButton, { key: 'grid', value: 'grid' }, 'Grid'),
h(ActionButton, { key: 'list', value: 'list' }, 'List'),
],
})(document.querySelector('.action-button-group'));
  • ActionButton — the option elements you pass as children.
  • Button — for standalone primary and secondary actions.