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" role="button"> Cyclical </button>
<button class="mds-button mds-button--secondary" type="button" role="button"> Defensive </button>
<button class="mds-button mds-button--secondary" type="button" role="button"> Sensitive </button>
</div>
<div class="mds-button-group">
<button class="mds-button mds-button--secondary" type="button" role="button"> Cyclical </button>
<button class="mds-button mds-button--secondary" type="button" role="button"> Defensive </button>
<button class="mds-button mds-button--secondary" type="button" disabled role="button"> 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--48842">
<input id="cyclical--48842" class="mds-button__input" type="radio" name="radio-colors-secondary" checked>
<span for="cyclical--48842" class="mds-button mds-button--secondary" role="button"> Cyclical </span>
</label>
<label class="mds-button__input-outer-wrapper" for="defensive--48612">
<input id="defensive--48612" class="mds-button__input" type="radio" name="radio-colors-secondary">
<span for="defensive--48612" class="mds-button mds-button--secondary" role="button"> Defensive </span>
</label>
<label class="mds-button__input-outer-wrapper" for="sensitive--43859">
<input id="sensitive--43859" class="mds-button__input" type="radio" name="radio-colors-secondary">
<span for="sensitive--43859" class="mds-button mds-button--secondary" role="button"> 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--33310">
<input id="filter--33310" class="mds-button__input" type="radio" name="radio-mixed-secondary" checked>
<span for="filter--33310" class="mds-button mds-button--secondary" role="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.svg#filter--s"> </use>
</svg>
<span class="mds-button__text"> Filter </span>
</span>
</label>
<label class="mds-button__input-outer-wrapper" for="upload--36541">
<input id="upload--36541" class="mds-button__input" type="radio" name="radio-mixed-secondary">
<span for="upload--36541" class="mds-button mds-button--secondary" role="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.svg#upload--s"> </use>
</svg>
<span class="mds-button__text"> Upload </span>
</span>
</label>
<label class="mds-button__input-outer-wrapper" for="search--44613">
<input id="search--44613" class="mds-button__input" type="radio" name="radio-mixed-secondary">
<span for="search--44613" class="mds-button mds-button--secondary" role="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.svg#search--s"> </use>
</svg>
<span class="mds-button__text"> Search </span>
</span>
</label>
</div>
<div class="mds-button-group">
<label class="mds-button__input-outer-wrapper" for="cyclical--83961">
<input id="cyclical--83961" class="mds-button__input" type="radio" name="radio-colors-small-secondary" checked>
<span for="cyclical--83961" class="mds-button mds-button--secondary mds-button--small" role="button"> Cyclical </span>
</label>
<label class="mds-button__input-outer-wrapper" for="defensive--43563">
<input id="defensive--43563" class="mds-button__input" type="radio" name="radio-colors-small-secondary">
<span for="defensive--43563" class="mds-button mds-button--secondary mds-button--small" role="button"> Defensive </span>
</label>
<label class="mds-button__input-outer-wrapper" for="sensitive--5297">
<input id="sensitive--5297" class="mds-button__input" type="radio" name="radio-colors-small-secondary">
<span for="sensitive--5297" class="mds-button mds-button--secondary mds-button--small" role="button"> Sensitive </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" role="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.svg#bell-padless"> </use>
</svg>
</button>
<button class="mds-button mds-button--icon-only" type="button" role="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.svg#create-padless"> </use>
</svg>
</button>
<button class="mds-button mds-button--icon-only" type="button" role="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.svg#question-circle-padless"> </use>
</svg>
</button>
<button class="mds-button mds-button--icon-only" type="button" role="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.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" role="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.svg#bell-padless"> </use>
</svg>
</button>
<button class="mds-button mds-button--icon-only" type="button" role="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.svg#create-padless"> </use>
</svg>
</button>
<button class="mds-button mds-button--icon-only mds-button--disabled" type="button" disabled role="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.svg#question-circle-padless"> </use>
</svg>
</button>
<button class="mds-button mds-button--icon-only" type="button" role="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.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 mds-button--small" type="button" role="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.svg#search--s"> </use>
</svg>
</button>
<button class="mds-button mds-button--icon-only mds-button--small" type="button" role="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.svg#heart--s"> </use>
</svg>
</button>
<button class="mds-button mds-button--icon-only mds-button--small" type="button" role="button">
<svg class="mds-icon mds-button__icon mds-button__icon--left" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.svg#pencil--s"> </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-xl
space, and vertically align middle the icon-only button group.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. |