Skip to content

ButtonGroup

ButtonGroup is used to group a series of buttons together, supporting horizontal and vertical layouts, and can uniformly set the size, color and variant of all buttons in the group.

Basic Usage

The simplest button group, used to combine a series of related operations.

vue
<template>
  <u-button-group>
    <u-button color="primary">Left</u-button>
    <u-button color="primary">Middle</u-button>
    <u-button color="primary">Right</u-button>
  </u-button-group>
</template>

Uniform Size

Uniformly set the size of all buttons in the group through the size property.

vue
<template>
  <u-button-group size="small">
    <u-button color="primary">Small</u-button>
    <u-button color="primary">Small</u-button>
    <u-button color="primary">Small</u-button>
  </u-button-group>

  <u-button-group size="medium">
    <u-button color="primary">Medium</u-button>
    <u-button color="primary">Medium</u-button>
    <u-button color="primary">Medium</u-button>
  </u-button-group>

  <u-button-group size="large">
    <u-button color="primary">Large</u-button>
    <u-button color="primary">Large</u-button>
    <u-button color="primary">Large</u-button>
  </u-button-group>
</template>

Uniform Color

Uniformly set the color of all buttons in the group through the color property.

vue
<template>
  <u-button-group color="primary">
    <u-button>Primary</u-button>
    <u-button>Primary</u-button>
    <u-button>Primary</u-button>
  </u-button-group>

  <u-button-group color="success">
    <u-button>Success</u-button>
    <u-button>Success</u-button>
    <u-button>Success</u-button>
  </u-button-group>

  <u-button-group color="warning">
    <u-button>Warning</u-button>
    <u-button>Warning</u-button>
    <u-button>Warning</u-button>
  </u-button-group>

  <u-button-group color="error">
    <u-button>Error</u-button>
    <u-button>Error</u-button>
    <u-button>Error</u-button>
  </u-button-group>
</template>

Uniform Variant

Uniformly set the variant style of all buttons in the group through the variant property.

vue
<template>
  <u-button-group variant="outlined" color="primary">
    <u-button>Outlined</u-button>
    <u-button>Outlined</u-button>
    <u-button>Outlined</u-button>
  </u-button-group>

  <u-button-group variant="text" color="primary">
    <u-button>Text</u-button>
    <u-button>Text</u-button>
    <u-button>Text</u-button>
  </u-button-group>

  <u-button-group variant="tonal" color="primary">
    <u-button>Tonal</u-button>
    <u-button>Tonal</u-button>
    <u-button>Tonal</u-button>
  </u-button-group>
</template>

Vertical Layout

Set the button group to vertical layout through the vertical property.

vue
<template>
  <u-button-group vertical color="primary">
    <u-button>Top</u-button>
    <u-button>Middle</u-button>
    <u-button>Bottom</u-button>
  </u-button-group>

  <u-button-group vertical variant="outlined" color="primary">
    <u-button>Top</u-button>
    <u-button>Middle</u-button>
    <u-button>Bottom</u-button>
  </u-button-group>
</template>

Props

PropDescriptionTypeDefaultAccepted Values
sizeUniform size setting for buttons in groupstring-small / medium / large
colorUniform color setting for buttons in groupstring-primary / success / warning / error / info
variantUniform variant for buttons in groupstring-contained / outlined / text / tonal
verticalWhether to arrange verticallybooleanfalse-

Slots

SlotDescription
defaultButton group content, place UButton components