Button Groups join two or more buttons into a unified control, formerly called a segmented control.
Use to create a mutually exclusive toggle. Buttons within the group follow the same visual and behavioral conventions as the secondary Button.
<div class="mds-button-group">
<button class="mds-button mds-button--secondary" type="button"> Cyclical </button>
<button class="mds-button mds-button--secondary" type="button"> Defensive </button>
<button class="mds-button mds-button--secondary" type="button"> Sensitive </button>
</div>
<div class="mds-button-group">
<button class="mds-button mds-button--secondary" type="button"> Cyclical </button>
<button class="mds-button mds-button--secondary" type="button"> Defensive </button>
<button class="mds-button mds-button--secondary" type="button" disabled> Sensitive </button>
</div>
Use when you want the button group to span the full width of its container.
<div class="mds-button-group mds-button-group--justify">
<label class="mds-button__input-outer-wrapper" for="cyclical--26745">
<input id="cyclical--26745" class="mds-button__input" type="radio" name="radio-colors-secondary" checked>
<span for="cyclical--26745" class="mds-button mds-button--secondary"> Cyclical </span>
</label>
<label class="mds-button__input-outer-wrapper" for="defensive--8289">
<input id="defensive--8289" class="mds-button__input" type="radio" name="radio-colors-secondary">
<span for="defensive--8289" class="mds-button mds-button--secondary"> Defensive </span>
</label>
<label class="mds-button__input-outer-wrapper" for="sensitive--23062">
<input id="sensitive--23062" class="mds-button__input" type="radio" name="radio-colors-secondary">
<span for="sensitive--23062" class="mds-button mds-button--secondary"> Sensitive </span>
</label>
</div>
Use Icons to provide additional affordance to a button.
<div class="mds-button-group">
<label class="mds-button__input-outer-wrapper" for="filter--34140">
<input id="filter--34140" class="mds-button__input" type="radio" name="radio-mixed-secondary" checked>
<span for="filter--34140" class="mds-button mds-button--secondary">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/icons/mds.svg#funnel--s"> </use>
</svg>
<span class="mds-button__text"> Filter </span>
</span>
</label>
<label class="mds-button__input-outer-wrapper" for="upload--55144">
<input id="upload--55144" class="mds-button__input" type="radio" name="radio-mixed-secondary">
<span for="upload--55144" class="mds-button mds-button--secondary">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/icons/mds.svg#upload--s"> </use>
</svg>
<span class="mds-button__text"> Upload </span>
</span>
</label>
<label class="mds-button__input-outer-wrapper" for="search--95908">
<input id="search--95908" class="mds-button__input" type="radio" name="radio-mixed-secondary">
<span for="search--95908" class="mds-button mds-button--secondary">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/icons/mds.svg#search--s"> </use>
</svg>
<span class="mds-button__text"> Search </span>
</span>
</label>
</div>
Use to create toolbars.
<div class="mds-button-group mds-button-group--icon-only">
<button class="mds-button mds-button--icon-only" type="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/icons/mds.svg#bell-padless"> </use>
</svg>
</button>
<button class="mds-button mds-button--icon-only" type="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/icons/mds.svg#create-padless"> </use>
</svg>
</button>
<button class="mds-button mds-button--icon-only" type="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/icons/mds.svg#question-circle-padless"> </use>
</svg>
</button>
<button class="mds-button mds-button--icon-only" type="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/icons/mds.svg#person-padless"> </use>
</svg>
</button>
</div>
<div class="mds-button-group mds-button-group--icon-only">
<button class="mds-button mds-button--icon-only" type="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/icons/mds.svg#bell-padless"> </use>
</svg>
</button>
<button class="mds-button mds-button--icon-only" type="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/icons/mds.svg#create-padless"> </use>
</svg>
</button>
<button class="mds-button mds-button--icon-only mds-button--disabled" type="button" disabled>
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/icons/mds.svg#question-circle-padless"> </use>
</svg>
</button>
<button class="mds-button mds-button--icon-only" type="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/icons/mds.svg#person-padless"> </use>
</svg>
</button>
</div>
aria-label
attributes to describe each button's intent. For example, <button aria-label="Close" onclick="myDialog.close()">X</button>
.$mds-space-inline-right-2-x
space, and vertically align middle the icon-only button group.<div class="mds-button-group">
<label class="mds-button__input-outer-wrapper" for="cyclical--55150">
<input id="cyclical--55150" class="mds-button__input" type="radio" name="small" checked>
<span for="cyclical--55150" class="mds-button mds-button--secondary mds-button--small"> Cyclical </span>
</label>
<label class="mds-button__input-outer-wrapper" for="defensive--53609">
<input id="defensive--53609" class="mds-button__input" type="radio" name="small">
<span for="defensive--53609" class="mds-button mds-button--secondary mds-button--small"> Defensive </span>
</label>
<label class="mds-button__input-outer-wrapper" for="sensitive--49285">
<input id="sensitive--49285" class="mds-button__input" type="radio" name="small">
<span for="sensitive--49285" class="mds-button mds-button--secondary mds-button--small"> Sensitive </span>
</label>
</div>
<br>
<br>
<div class="mds-button-group">
<label class="mds-button__input-outer-wrapper" for="filter--93867">
<input id="filter--93867" class="mds-button__input" type="radio" name="small-with-icon" checked>
<span for="filter--93867" class="mds-button mds-button--secondary mds-button--small">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/icons/mds.svg#funnel--s"> </use>
</svg>
<span class="mds-button__text"> Filter </span>
</span>
</label>
<label class="mds-button__input-outer-wrapper" for="upload--1753">
<input id="upload--1753" class="mds-button__input" type="radio" name="small-with-icon">
<span for="upload--1753" class="mds-button mds-button--secondary mds-button--small">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/icons/mds.svg#upload--s"> </use>
</svg>
<span class="mds-button__text"> Upload </span>
</span>
</label>
<label class="mds-button__input-outer-wrapper" for="search--54657">
<input id="search--54657" class="mds-button__input" type="radio" name="small-with-icon">
<span for="search--54657" class="mds-button mds-button--secondary mds-button--small">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/icons/mds.svg#search--s"> </use>
</svg>
<span class="mds-button__text"> Search </span>
</span>
</label>
</div>
<br>
<br>
<div class="mds-button-group mds-button-group--icon-only">
<button class="mds-button mds-button--icon-only mds-button--small" type="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/icons/mds.svg#search--s"> </use>
</svg>
</button>
<button class="mds-button mds-button--icon-only mds-button--small" type="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/icons/mds.svg#heart--s"> </use>
</svg>
</button>
<button class="mds-button mds-button--icon-only mds-button--small" type="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/icons/mds.svg#pencil--s"> </use>
</svg>
</button>
</div>
Icon size is predetermined and applied automatically. To avoid undesirable scaling of icon artwork, use the chart below to choose the correct icon size to use in your button group.
Type |
Small |
Medium |
Large |
---|---|---|---|
Default |
|||
Icon Only |
N/A |
role="group"
attribute for a default button group.role="navigation"
.role="toolbar"
.aria-label="..."
to describe the intention of the button group.aria-label="View Toggle"
could describe a button group set that changes the view of a content module below the button group.
Class |
Applies to |
Outcome |
---|---|---|
|
|
Adding an |
|
|
Adding this modifier to the |
|
|
Adding this modifier to the |
|
|
Adding this modifier keeps all of the buttons the same height even when one of the buttons has wrapping text. Only use when text wrapping occurs within the button group. |