Button groups combine related buttons into a single visual unit. Use them for toolbars, segmented controls,
or any set of actions that belong together.
< cs-button-group label = " Alignment" >
< cs-button appearance = " filled" > Left</ cs-button>
< cs-button appearance = " filled" > Center</ cs-button>
< cs-button appearance = " filled" > Right</ cs-button>
</ cs-button-group>
Code
Give every button group a label.
It isn’t shown on screen, but assistive devices announce it so people know what the grouped buttons control.
Examples
Orientation
Set the orientation attribute to vertical to stack the buttons instead of placing them side by side.
< cs-button-group orientation = " vertical" label = " Options" >
< cs-button appearance = " filled" > Top</ cs-button>
< cs-button appearance = " filled" > Middle</ cs-button>
< cs-button appearance = " filled" > Bottom</ cs-button>
</ cs-button-group>
Code
Pill
Add the pill attribute to each button to round the group’s outer edges.
< cs-button-group label = " Alignment" >
< cs-button appearance = " filled" size = " m" pill > Left</ cs-button>
< cs-button appearance = " filled" size = " m" pill > Center</ cs-button>
< cs-button appearance = " filled" size = " m" pill > Right</ cs-button>
</ cs-button-group>
Code
Dropdowns
Place a dropdown anywhere in the group to attach a menu of related actions.
Edit
More
Cut
Copy
Paste
Delete
< cs-button-group label = " Options" >
< cs-button appearance = " filled" > Edit</ cs-button>
< cs-dropdown>
< cs-button appearance = " filled" slot = " trigger" with-caret > More</ cs-button>
< cs-dropdown-item> Cut</ cs-dropdown-item>
< cs-dropdown-item> Copy</ cs-dropdown-item>
< cs-dropdown-item> Paste</ cs-dropdown-item>
</ cs-dropdown>
< cs-button appearance = " filled" > Delete</ cs-button>
</ cs-button-group>
Code
Pair a primary button with a dropdown to make a split button. Give the dropdown trigger an accessible label so people using assistive devices know what it opens.
Save
Save
Save as…
Save all
< cs-button-group label = " Save" >
< cs-button appearance = " filled" variant = " brand" > Save</ cs-button>
< cs-dropdown placement = " bottom-end" >
< cs-button appearance = " filled" slot = " trigger" variant = " brand" >
< cs-icon name = " keyboard_arrow_down" label = " More options" > </ cs-icon>
</ cs-button>
< cs-dropdown-item> Save</ cs-dropdown-item>
< cs-dropdown-item> Save as… </ cs-dropdown-item>
< cs-dropdown-item> Save all</ cs-dropdown-item>
</ cs-dropdown>
</ cs-button-group>
Code
Pair each button with a tooltip to explain what it does on hover and focus.
Left
Center
Right
Align left
Align center
Align right
< cs-button-group label = " Alignment" >
< cs-button appearance = " filled" id = " button-left" > Left</ cs-button>
< cs-button appearance = " filled" id = " button-center" > Center</ cs-button>
< cs-button appearance = " filled" id = " button-right" > Right</ cs-button>
</ cs-button-group>
< cs-tooltip for = " button-left" > Align left</ cs-tooltip>
< cs-tooltip for = " button-center" > Align center</ cs-tooltip>
< cs-tooltip for = " button-right" > Align right</ cs-tooltip>
Code
Combine several button groups into a toolbar of related action sets. Use icon-only buttons with label for compact controls, and tooltips to name each one.
Undo
Redo
Bold
Italic
Underline
Align left
Align center
Align right
< div class = " button-group-toolbar cs-cluster" >
< cs-button-group label = " History" >
< cs-button appearance = " filled" id = " undo-button"
> < cs-icon name = " undo" label = " Undo" > </ cs-icon
> </ cs-button>
< cs-button appearance = " filled" id = " redo-button"
> < cs-icon name = " redo" label = " Redo" > </ cs-icon
> </ cs-button>
</ cs-button-group>
< cs-button-group label = " Formatting" >
< cs-button appearance = " filled" id = " button-bold"
> < cs-icon name = " format_bold" label = " Bold" > </ cs-icon
> </ cs-button>
< cs-button appearance = " filled" id = " button-italic"
> < cs-icon name = " format_italic" label = " Italic" > </ cs-icon
> </ cs-button>
< cs-button appearance = " filled" id = " button-underline"
> < cs-icon name = " format_underlined" label = " Underline" > </ cs-icon
> </ cs-button>
</ cs-button-group>
< cs-button-group label = " Alignment" >
< cs-button appearance = " filled" id = " button-align-left"
> < cs-icon name = " format_align_left" label = " Align left" > </ cs-icon
> </ cs-button>
< cs-button appearance = " filled" id = " button-align-center"
> < cs-icon name = " format_align_center" label = " Align center" > </ cs-icon
> </ cs-button>
< cs-button appearance = " filled" id = " button-align-right"
> < cs-icon name = " format_align_right" label = " Align right" > </ cs-icon
> </ cs-button>
</ cs-button-group>
</ div>
< cs-tooltip for = " undo-button" > Undo</ cs-tooltip>
< cs-tooltip for = " redo-button" > Redo</ cs-tooltip>
< cs-tooltip for = " button-bold" > Bold</ cs-tooltip>
< cs-tooltip for = " button-italic" > Italic</ cs-tooltip>
< cs-tooltip for = " button-underline" > Underline</ cs-tooltip>
< cs-tooltip for = " button-align-left" > Align left</ cs-tooltip>
< cs-tooltip for = " button-align-center" > Align center</ cs-tooltip>
< cs-tooltip for = " button-align-right" > Align right</ cs-tooltip>
Code
Button groups also work with native <button> elements when Native Styles are included.
< cs-button-group label = " Alignment" >
< button class = " cs-filled" > Left</ button>
< button class = " cs-filled" > Center</ button>
< button class = " cs-filled" > Right</ button>
</ cs-button-group>
Code
API
Importing
If you're using the autoloader or a hosted project, components load on demand — no manual import
needed. To cherry-pick this component, use one of the following snippets.
npm
Self-Hosted
React
import '@cruglobal/cornerstone-components/components/button-group/button-group.js' ;
import './cornerstone/components/button-group/button-group.js' ;
import CsButtonGroup from '@cruglobal/cornerstone-components/react/button-group/index.js' ;
Slots
Learn more about using slots .
Name Description (default) One or more <cs-button> elements to display in the button group.
Attributes & Properties
Learn more about attributes and properties .
Property Attribute Description Type Default Reflects labellabelA label to use for the button group. This won't be displayed on the screen, but it will be announced by assistive devices when interacting with the control and is strongly recommended. string''— orientationorientationThe button group's orientation. 'horizontal' | 'vertical''horizontal'Yes