|
| 1 | +--- |
| 2 | +title: React Bootstrap Button Group Component |
| 3 | +name: Button Group with Bootstrap Styling |
| 4 | +description: Learn how to group buttons using the React Bootstrap Button Group component from CoreUI. Create accessible, styled toolbars and button sets with ease. |
| 5 | +route: /components/button-group/ |
| 6 | +bootstrap_component: true |
| 7 | +--- |
| 8 | + |
| 9 | +## How to use React Bootstrap Button Group component |
| 10 | + |
| 11 | +The React Bootstrap Button Group component allows you to group multiple buttons together into a single toolbar-like unit. Wrap a series of `<CButton>` components in a `<CButtonGroup>` to get started. |
| 12 | + |
| 13 | +<ExampleSnippet className="theme-bootstrap" component="ButtonGroupExample" componentName="React Bootstrap Button Group" /> |
| 14 | + |
| 15 | +<Callout color="info" title={<>Ensure the correct <code>role</code> and provide a label</>}> |
| 16 | + For assistive technologies (e.g. screen readers) to identify a set of buttons as grouped, use `role="group"` for button groups and `role="toolbar"` for toolbars. |
| 17 | + |
| 18 | + Always include an accessible label using `aria-label` or `aria-labelledby` to clarify the purpose of the group. |
| 19 | +</Callout> |
| 20 | + |
| 21 | +React Bootstrap Button Groups can also be applied to a group of links instead of using the [`CNav`](./../navs-tabs/#base-nav) component. |
| 22 | + |
| 23 | +<ExampleSnippet className="theme-bootstrap" component="ButtonGroup2Example" componentName="React Bootstrap Button Group" /> |
| 24 | + |
| 25 | +## Mixed styles in React Bootstrap Button Groups |
| 26 | + |
| 27 | +Combine buttons with different styles within a single group for more flexible UI designs. |
| 28 | + |
| 29 | +<ExampleSnippet className="theme-bootstrap" component="ButtonGroupMixedStylesExample" componentName="React Bootstrap Button Group" /> |
| 30 | + |
| 31 | +## Outlined button styles |
| 32 | + |
| 33 | +Use `variant="outline"` on grouped buttons to apply Bootstrap's outline button style across the group. |
| 34 | + |
| 35 | +<ExampleSnippet className="theme-bootstrap" component="ButtonGroupOutlinedStylesExample" componentName="React Bootstrap Button Group" /> |
| 36 | + |
| 37 | +## Checkbox and radio button groups |
| 38 | + |
| 39 | +Create interactive grouped controls by combining button-style checkboxes and radio buttons inside a React Bootstrap Button Group. |
| 40 | + |
| 41 | +<ExampleSnippet className="theme-bootstrap" component="ButtonGroupCheckboxAndRadioExample" componentName="React Bootstrap Button Group" /> |
| 42 | + |
| 43 | +<ExampleSnippet className="theme-bootstrap" component="ButtonGroupCheckboxAndRadio2Example" componentName="React Bootstrap Button Group" /> |
| 44 | + |
| 45 | +## React Bootstrap Button Toolbar |
| 46 | + |
| 47 | +Group multiple button groups together into a toolbar using `<CButtonToolbar>`. Combine with layout utilities to control spacing and alignment. |
| 48 | + |
| 49 | +<ExampleSnippet className="theme-bootstrap" component="ButtonToolbarExample" componentName="React Bootstrap Button Group" /> |
| 50 | + |
| 51 | +You can also combine input groups with button groups to create interactive toolbars. |
| 52 | + |
| 53 | +<ExampleSnippet className="theme-bootstrap" component="ButtonToolbar2Example" componentName="React Bootstrap Button Group" /> |
| 54 | + |
| 55 | +## Sizing React Bootstrap Button Groups |
| 56 | + |
| 57 | +Instead of setting size on individual buttons, apply the `size` prop to the `<CButtonGroup>` to make all buttons within it uniformly sized. |
| 58 | + |
| 59 | +<ExampleSnippet className="theme-bootstrap" component="ButtonGroupSizingExample" componentName="React Bootstrap Button Group" /> |
| 60 | + |
| 61 | +## Nesting button groups |
| 62 | + |
| 63 | +Nest a `<CButtonGroup>` inside another to combine dropdowns with standard buttons, as supported in React Bootstrap Button Group usage. |
| 64 | + |
| 65 | +<ExampleSnippet className="theme-bootstrap" component="ButtonGroupNestingExample" componentName="React Bootstrap Button Group" /> |
| 66 | + |
| 67 | +## Vertical React Bootstrap Button Groups |
| 68 | + |
| 69 | +Stack buttons vertically using the vertical variation of React Bootstrap Button Group. Note: split dropdowns are not supported in vertical mode. |
| 70 | + |
| 71 | +<ExampleSnippet className="theme-bootstrap" component="ButtonGroupVerticalExample" componentName="React Bootstrap Button Group" /> |
| 72 | + |
| 73 | +## API reference |
| 74 | + |
| 75 | +Explore the API documentation for available props and configuration for the React Bootstrap Button Group component and toolbars. |
| 76 | + |
| 77 | +- [<CButtonGroup />](./api/#cbuttongroup) |
| 78 | +- [<CButtonToolbar />]() |
0 commit comments