v7.3.0

ButtonGroup
Widget

A specialized container that holds buttons, displaying them in a tightly joined horizontal group with shared borders. Only Button widgets are allowed as children — adding other widget types will throw an exception. Use toggleGroup or toggleable to turn the group into a toggle bar where one or more buttons can be pressed at a time. The visual style of all buttons can be set uniformly with the rendition config.

new ButtonGroup({
    toggleGroup : true,
    items       : [
        { icon : 'fa fa-align-left',    pressed : true },
        { icon : 'fa fa-align-center' },
        { icon : 'fa fa-align-right' }
    ]
});

Useful configs, properties, and events

Config / Event Description
items Array of button configs or Button instances
color Default color applied to all contained buttons
toggleGroup Enable toggle-group behavior for all buttons
toggleable Min/max range of simultaneously pressed buttons
rendition Visual style: 'filled', 'outlined', 'tonal', 'text', etc.
click Fired when a button in the group is clicked
toggle Fired when a button's pressed state changes

See also

  • Button - Individual button widget
  • Toolbar - A more general container for buttons and other widgets
No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • Default color to apply to all contained buttons, see Button#color. Individual buttons can override the default.

  • An array of Buttons or typed Button config objects.

  • Set to true to turn the ButtonGroup into a toggle group, assigning a generated value to each contained buttons toggleGroup config. Individual buttons can override the default.

  • useGap : Booleanfalse

    If you use gaps between your buttons, set this to true (controls whether to use border-radius for the button elements)

Properties

Properties are getters/setters or publicly accessible variables on this class
  • isButtonGroup : Booleantrue
    READONLY
    ADVANCED
    Identifies an object as an instance of ButtonGroup class, or subclass thereof.

Events

Events are triggered for certain actions in this class and can be listened for to react to those actions in your code

Event handlers

Event handlers are callbacks called as a result of certain actions in this class

CSS variables

CSS variables that can be set to adjust appearance
Name Description
--b-button-group-border-color ButtonGroup border color, overridden by `--b-button-outlined-border-color` when using outlined rendition
--b-button-group-border-radius ButtonGroup border-radius, should normally match Button border-radius (cannot hide overflow, since badges need to stay visible)
--b-button-group-border-width ButtonGroup border width, overridden by `--b-button-outlined-border-width` when using outlined rendition
--b-button-group-box-shadow ButtonGroup box-shadow, overridden by `--b-button-elevated-box-shadow` when using elevated rendition
--b-button-group-padded-active-background Background for active (held down) button when using "padded" rendition
--b-button-group-padded-background Background when using "padded" rendition
--b-button-group-padded-border Border for the button group when using "padded" rendition
--b-button-group-padded-button-opacity Opacity of the buttons in the group when using "padded" rendition
--b-button-group-padded-filled-pressed-background Background for pressed button when using "padded-filled" rendition
--b-button-group-padded-filled-pressed-color Text color for pressed button when using "padded-filled" rendition
--b-button-group-padded-filled-pressed-hover-background Background for hovered pressed button when using "padded-filled" rendition (when not in a toggle group)
--b-button-group-padded-padding Padding when using "padded" rendition
--b-button-group-padded-pressed-background Background for pressed button when using "padded" rendition
--b-button-group-padded-pressed-border Border for pressed button when using "padded" rendition
--b-button-group-padded-pressed-box-shadow Box-shadow for pressed button when using "padded" rendition
--b-button-group-padded-pressed-hover-background Background for hovered pressed button when using "padded" rendition (when not in a toggle group)
type: buttonGroup

Source path

Core/widget/ButtonGroup.js

Contents