Skip to content

button_group — Button group ​

One to three buttons in a row, sharing size and alignment.

The button_group block, rendered

A row of call-to-action buttons that sit side by side and wrap together. Each entry has its own label, URL and variant; the size and alignment are shared by the whole row, so the buttons always match. Links go through the same safe-URL guard as button.

When to use ​

A primary and a secondary action next to each other ("Buy" / "Learn more"), store badges, a short list of equal choices.

Configuration ​

Configure under content_blocks_kit.blocks.button_group (see Configuring blocks for how the levers combine).

Options ​

Block-level knobs, set under options:.

OptionDefault
max_items3

Choice fields ​

Selectable values. Restrict or reorder them per host with choices: (the default is shown in bold).

FieldValues
variantprimary, secondary, outline, link
sizesm, md, lg
alignstart, center, end

Default data ​

Initial values for a new block. Override per host with defaults:.

FieldDefault
items[{"text":"Learn more","url":"","variant":"primary","newTab":false},{"text":"Contact us","url":"","variant":"outline","newTab":false}]
sizemd
alignstart
stackOnMobilefalse

Example ​

yaml
# config/packages/content_blocks_kit.yaml
content_blocks_kit:
    blocks:
        button_group:
            options: { max_items: 3 }
            choices: { variant: [primary, secondary] }   # restrict / reorder the picker
            defaults: { size: md }

Front-end ​

Rendered markup: .cb-kit-btn-group with an alignment modifier, and --stack when Stack on mobile is on; each entry is a .cb-kit-btn. Style it by overriding the --cb-kit-* custom properties (see the kit stylesheet).

Notes ​

  • The max_items option caps the number of buttons (3 by default).
  • Stack on mobile puts the buttons one under the other on small screens.

The configuration tables above are generated from content-blocks-kit:blocks --format=json, read straight from the block's code — they never go stale.

Released under the MIT License.