Skip to content

SButtonGroup <s-button-group>

ts
import { SButtonGroup } from 'polaris-vue-elements'

Example

ListGrid
SaveCancelDiscard
vue
<script setup>
import { SButton, SButtonGroup, SPressButton } from 'polaris-vue-elements'
</script>

<template>
  <!-- Default slot: a plain segmented group of PressButtons -->
  <SButtonGroup>
    <SPressButton>List</SPressButton>
    <SPressButton pressed>Grid</SPressButton>
  </SButtonGroup>

  <!-- primary-action/secondary-actions slots follow the same variant rules as SModal:
       primary-action accepts a single variant="primary" button, secondary-actions
       accepts variant="secondary" (or "auto") buttons. -->
  <SButtonGroup>
    <template #primary-action>
      <SButton variant="primary">Save</SButton>
    </template>
    <template #secondary-actions>
      <SButton variant="secondary">Cancel</SButton>
      <SButton variant="secondary">Discard</SButton>
    </template>
  </SButtonGroup>
</template>

Props

PropTypeDescription
accessibilityLabelstringLabel for the button group that describes the content of the group for screen reader users to understand what's included.
gap"base" | "none"The gap between elements.

Slots

SlotDescription
defaultThe content of the ButtonGroup.
primary-actionThe primary action button for the group. Accepts a single Button element with a variant of primary. Cannot be used when gap="none".
secondary-actionsSecondary action buttons for the group. Accepts Button or PressButton elements with a variant of secondary or auto.