Skip to content
On this page

ButtonGroup

A set of two or more buttons representing related actions.

Buttons in this button group signal a number of equally important actions that will occur when the user taps on them. Button groups feature a set of normal buttons that can include icons and/or text labels.

Demos

Open up the browser console to see events emitted on click.

Basic usage

Describe the buttons in the group with an array of ButtonGroupItem objects. The text in the label property will be displayed in the buttons. When a button is clicked, a click event will be emitted with the value property of the clicked button. Values must be unique within a button group.

If the label property is omitted, the value property will be used as the label. This allows using { value: 'Foo' } as a shorthand for { label: 'Foo', value: 'Foo' }.

NameValue
View
Reading direction

With icons

Use the icon property to add an icon before the text of a button. Use the disabled property to disable individual buttons.

Icon-only buttons

To display an icon as the only content of a button, use the icon property to specify an icon, and set the label property to null.

Disabled

The entire component can be disabled by setting the disabled prop. Individual buttons can be disabled by setting their .disabled property. Clicking a disabled button does not emit a click event.

Overflowing buttons

When the button group is too large to fit on one line, the buttons overflow to the next line.

Custom button display

The contents of the buttons can be customized using the default slot. The ButtonGroupItem object for each button is available through the button binding. In this example, the value of the button is displayed in superscript after its label.

Usage

Props

Prop nameDescriptionTypeDefault
buttons(required)Objects describing the buttons in the group. See the ButtonGroupItem type.ButtonGroupItem[]
disabledWhether the entire group is disabled.

If this is set to true, all buttons in the group are disabled. Buttons can also be disabled individually by setting their disabled property to true.
booleanfalse

Events

Event namePropertiesDescription
clickvalue string|number - The value property of the button that was clickedEmitted when a button is clicked

Slots

NameDescriptionBindings
defaultContent of an individual buttonbutton ButtonGroupItem - Object describing the button to display