The ButtonGroup component renders a group of related buttons next to each other.
| # | Required | Element | Description |
|---|---|---|---|
| 1 | Group | Wraps two or more Buttons and decides whether they connect or separate. When separated, applies gap spacing between the Buttons. | |
| 2 | Button | A single action in the group. |
ButtonGroups wrap two or more Buttons together to treat them as a unified set of related actions. Grouping also allows the Buttons to inherit props for variant, size, and disabled state. Buttons may either be connected (segmented) or spaced.
ButtonGroups and Tabs both use an inline set of buttons to perform a task. Be sure to understand the difference between them as they are not interchangeable:
Buttons may be rendered as a segmented, "single" group or separated with gap spacing. Use the segmented variant when the actions are closely-related within a single context, such as zoom controls, as a WYSIWYG editing toolbar, forward and back buttons, etc. Use the spaced variant for form submission and cancellation or actions within a modal's footer.
Consistency matters. Avoid mixing sizes or variants on individual Buttons to maintain a clean interface.
Limit group size to four Buttons maximum. A larger group is more difficult to scan as the Buttons take up more space on the page. Consider placing extra actions into a contextual DropdownMenu, or pairing the main action with one in a split button.
Toolbars with Icon-only Buttons may include more visible Buttons before the rest are placed within a DropdownMenu.
Primary Buttons serve the purpose of highlighting the most important action a user may take on the current page. When placing Buttons in forms or where users are expected to complete a task, be mindful to set each action at the most appropriate importance level. Actions are displayed from most to least important starting from right to left.
Avoid placing more than one Primary Button within a workflow or page.
When using ButtonGroups, consider the following common configurations before creating a new design standard.
A segmented group of Icon-only Buttons acts as a compact toolbar for actions on a canvas or preview. Provide each Button an accessible label as there's no visible text.
Paired actions are the most common configuration, providing the user a way to accept or reject changes being made in the given context.
Pagination displays as a segmented collection of items used to help users navigate through sets of data in the form of pages.
Split buttons are used to display one main action with other contextual actions relegated to an adjacent DropdownMenu.
Buttons connect into a single, segmented control with overlapping borders.
Buttons maintain their default styling and have space-100 between them.
Icon-only ButtonGroups are used for toolbars. Use icons consistently—if one Button has an icon, they must all have icons.
Icons paired with labels are best suited for communicating actions that will take place.
Visible labels may be omitted for commonly-used icons.
Provide a label with less-common icons or to better communicate the action taking place.
ButtonGroups come in two sizes: medium and small. Setting the size on the group overrides the size prop set on the individual Button to maintain consistency.
Medium is the default size used in the majority of cases.
Small groups are used for smaller screen sizes and less prominent actions on the page.
The base Button uses the default variant colors when no user interaction is detected.
On mouse hover, Button styles update to hover colors.
Focused Buttons receive the standard 2px light blue outline.
On user activation, Button styles update on user activation.
Disabled Buttons cannot be interacted with. Lighter colors are used for all variants.
Buttons within the group inherit the variant, size, and disabled state through component props. Each prop functions slightly differently:
Buttons adhere to the group's settings.
Individual Buttons may opt out of the variant set by the group.
Button labels are written consistently across the application. For more information on writing labels, see the Content section on the Button page.