display: inline-flex;
vertical-align: middle; // match .btn alignment given font-size hack above
- > .btn,
- > .btn-check {
+ > [class*="btn-"] {
position: relative;
flex: 1 1 auto;
}
// the borders properly
> .btn-check:has(input:checked),
> .btn-check:has(input:focus),
- > .btn:hover,
- > .btn:focus,
- > .btn:active,
- > .btn.active {
+ > [class*="btn-"]:hover,
+ > [class*="btn-"]:focus,
+ > [class*="btn-"]:active,
+ > [class*="btn-"].active {
z-index: 1;
}
}
.btn-toolbar {
display: flex;
flex-wrap: wrap;
+ gap: .5rem;
justify-content: flex-start;
.input-group {
@include border-radius($btn-border-radius);
// Prevent double borders when buttons are next to each other
- > .btn:not(:first-child),
- > .btn-check:not(:first-child),
+ > [class*="btn-"]:not(:first-child),
> .btn-group:not(:first-child) {
margin-inline-start: calc(-1 * #{$btn-border-width});
}
// Reset rounded corners
- > .btn:not(:last-child):not(.dropdown-toggle),
- > .btn-check:not(:last-child),
- > .btn.dropdown-toggle-split:first-child,
- > .btn-group:not(:last-child) > .btn {
+ > [class*="btn-"]:not(:last-child):not(.dropdown-toggle),
+ > .btn-group:not(:last-child) > [class*="btn-"] {
@include border-end-radius(0);
}
// The left radius should be 0 if the button is not the first child
- > .btn:not(:first-child),
- > .btn-check:not(:first-child),
- > .btn-group:not(:first-child) > .btn {
+ > [class*="btn-"]:not(:first-child),
+ > .btn-group:not(:first-child) > [class*="btn-"] {
@include border-start-radius(0);
}
}
//
// Remix the default button sizing classes into new ones for easier manipulation.
- .btn-group-sm > .btn { @extend .btn-sm; }
- .btn-group-lg > .btn { @extend .btn-lg; }
+ // .btn-group-sm > [class*="btn-"] { @extend .btn-sm; }
+ // .btn-group-lg > [class*="btn-"] { @extend .btn-lg; }
//
align-items: flex-start;
justify-content: center;
- > .btn,
- > .btn-check,
+ > [class*="btn-"],
> .btn-group {
width: 100%;
}
- > .btn:not(:first-child),
- > .btn-check:not(:first-child),
+ > [class*="btn-"]:not(:first-child),
> .btn-group:not(:first-child) {
margin-top: calc(-1 * #{$btn-border-width});
}
// Reset rounded corners
- > .btn:not(:last-child):not(.dropdown-toggle),
- > .btn-check:not(:last-child),
- > .btn-group:not(:last-child) > .btn {
+ > [class*="btn-"]:not(:last-child):not(.dropdown-toggle),
+ > .btn-group:not(:last-child) > [class*="btn-"] {
@include border-bottom-radius(0);
}
// The top radius should be 0 if the button is not the first child
- > .btn:not(:first-child),
- > .btn-check:not(:first-child),
- > .btn-group:not(:first-child) > .btn {
+ > [class*="btn-"]:not(:first-child),
+ > .btn-group:not(:first-child) > [class*="btn-"] {
@include border-top-radius(0);
}
}
## Basic example
-Wrap a series of buttons with `.btn` in `.btn-group`.
+Wrap a series of buttons in `.btn-group`.
<Example code={`<div class="btn-group" role="group" aria-label="Basic example">
- <button type="button" class="btn btn-primary">Left</button>
- <button type="button" class="btn btn-primary">Middle</button>
- <button type="button" class="btn btn-primary">Right</button>
+ <button type="button" class="btn-solid theme-primary">Left</button>
+ <button type="button" class="btn-solid theme-primary">Middle</button>
+ <button type="button" class="btn-solid theme-primary">Right</button>
</div>`} />
<Callout>
These classes can also be added to groups of links, as an alternative to the [`.nav` navigation components]([[docsref:/components/navs-tabs]]).
<Example code={`<div class="btn-group">
- <a href="#" class="btn btn-primary active" aria-current="page">Active link</a>
- <a href="#" class="btn btn-primary">Link</a>
- <a href="#" class="btn btn-primary">Link</a>
+ <a href="#" class="btn-solid theme-primary active" aria-current="page">Active link</a>
+ <a href="#" class="btn-solid theme-primary">Link</a>
+ <a href="#" class="btn-solid theme-primary">Link</a>
</div>`} />
-## Mixed styles
+## Mixed variants
<Example code={`<div class="btn-group" role="group" aria-label="Basic mixed styles example">
- <button type="button" class="btn btn-danger">Left</button>
- <button type="button" class="btn btn-warning">Middle</button>
- <button type="button" class="btn btn-success">Right</button>
+ <button type="button" class="btn-solid theme-danger">Left</button>
+ <button type="button" class="btn-solid theme-warning">Middle</button>
+ <button type="button" class="btn-solid theme-success">Right</button>
</div>`} />
-## Outlined styles
+## Outline buttons
<Example code={`<div class="btn-group" role="group" aria-label="Basic outlined example">
- <button type="button" class="btn btn-outline-primary">Left</button>
- <button type="button" class="btn btn-outline-primary">Middle</button>
- <button type="button" class="btn btn-outline-primary">Right</button>
+ <button type="button" class="btn-outline theme-primary">Left</button>
+ <button type="button" class="btn-outline theme-primary">Middle</button>
+ <button type="button" class="btn-outline theme-primary">Right</button>
</div>`} />
-## Checkbox and radio button groups
+## Toggle buttons
-Combine button-like checkbox and radio toggle buttons into a seamless looking button group.
+### Checkbox
+
+Checkbox toggle buttons can be grouped together. Any or all of the buttons can be checked.
<Example code={`<div class="btn-group" role="group" aria-label="Basic checkbox toggle button group">
<label class="btn-check btn-outline theme-primary">
</label>
</div>`} />
+### Radio
+
+By design, radio toggle button groups can only have one button checked at a time.
+
<Example code={`<div class="btn-group" role="group" aria-label="Basic radio toggle button group">
<label class="btn-check btn-outline theme-primary">
<input type="radio" name="btnradio" autocomplete="off" checked>
Combine sets of button groups into button toolbars for more complex components. Use utility classes as needed to space out groups, buttons, and more.
<Example code={`<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups">
- <div class="btn-group me-2" role="group" aria-label="First group">
- <button type="button" class="btn btn-primary">1</button>
- <button type="button" class="btn btn-primary">2</button>
- <button type="button" class="btn btn-primary">3</button>
- <button type="button" class="btn btn-primary">4</button>
+ <div class="btn-group" role="group" aria-label="First group">
+ <button type="button" class="btn-solid theme-primary">1</button>
+ <button type="button" class="btn-solid theme-primary">2</button>
+ <button type="button" class="btn-solid theme-primary">3</button>
+ <button type="button" class="btn-solid theme-primary">4</button>
</div>
- <div class="btn-group me-2" role="group" aria-label="Second group">
- <button type="button" class="btn btn-secondary">5</button>
- <button type="button" class="btn btn-secondary">6</button>
- <button type="button" class="btn btn-secondary">7</button>
+ <div class="btn-group" role="group" aria-label="Second group">
+ <button type="button" class="btn-solid theme-secondary">5</button>
+ <button type="button" class="btn-solid theme-secondary">6</button>
+ <button type="button" class="btn-solid theme-secondary">7</button>
</div>
<div class="btn-group" role="group" aria-label="Third group">
- <button type="button" class="btn btn-info">8</button>
+ <button type="button" class="btn-solid theme-info">8</button>
</div>
</div>`} />
-Feel free to mix input groups with button groups in your toolbars. Similar to the example above, you’ll likely need some utilities though to space things properly.
+Feel free to mix input groups with button groups in your toolbars. Similar to the example above, you'll likely need some utilities though to space things properly.
-<Example code={`<div class="btn-toolbar mb-3" role="toolbar" aria-label="Toolbar with button groups">
- <div class="btn-group me-2" role="group" aria-label="First group">
- <button type="button" class="btn btn-outline-secondary">1</button>
- <button type="button" class="btn btn-outline-secondary">2</button>
- <button type="button" class="btn btn-outline-secondary">3</button>
- <button type="button" class="btn btn-outline-secondary">4</button>
+<Example class="d-flex gap-3 flex-column" code={`<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups">
+ <div class="btn-group" role="group" aria-label="First group">
+ <button type="button" class="btn-outline theme-secondary">1</button>
+ <button type="button" class="btn-outline theme-secondary">2</button>
+ <button type="button" class="btn-outline theme-secondary">3</button>
+ <button type="button" class="btn-outline theme-secondary">4</button>
</div>
<div class="input-group">
<div class="input-group-text" id="btnGroupAddon">@</div>
<div class="btn-toolbar justify-content-between" role="toolbar" aria-label="Toolbar with button groups">
<div class="btn-group" role="group" aria-label="First group">
- <button type="button" class="btn btn-outline-secondary">1</button>
- <button type="button" class="btn btn-outline-secondary">2</button>
- <button type="button" class="btn btn-outline-secondary">3</button>
- <button type="button" class="btn btn-outline-secondary">4</button>
+ <button type="button" class="btn-outline theme-secondary">1</button>
+ <button type="button" class="btn-outline theme-secondary">2</button>
+ <button type="button" class="btn-outline theme-secondary">3</button>
+ <button type="button" class="btn-outline theme-secondary">4</button>
</div>
<div class="input-group">
<div class="input-group-text" id="btnGroupAddon2">@</div>
Instead of applying button sizing classes to every button in a group, just add `.btn-group-*` to each `.btn-group`, including each one when nesting multiple groups.
-<Example code={`<div class="btn-group btn-group-lg" role="group" aria-label="Large button group">
- <button type="button" class="btn btn-outline-primary">Left</button>
- <button type="button" class="btn btn-outline-primary">Middle</button>
- <button type="button" class="btn btn-outline-primary">Right</button>
+<Example class="d-flex gap-3 flex-column align-items-start" code={`<div class="btn-group btn-group-lg" role="group" aria-label="Large button group">
+ <button type="button" class="btn-outline theme-primary">Left</button>
+ <button type="button" class="btn-outline theme-primary">Middle</button>
+ <button type="button" class="btn-outline theme-primary">Right</button>
</div>
- <br>
<div class="btn-group" role="group" aria-label="Default button group">
- <button type="button" class="btn btn-outline-primary">Left</button>
- <button type="button" class="btn btn-outline-primary">Middle</button>
- <button type="button" class="btn btn-outline-primary">Right</button>
+ <button type="button" class="btn-outline theme-primary">Left</button>
+ <button type="button" class="btn-outline theme-primary">Middle</button>
+ <button type="button" class="btn-outline theme-primary">Right</button>
</div>
- <br>
<div class="btn-group btn-group-sm" role="group" aria-label="Small button group">
- <button type="button" class="btn btn-outline-primary">Left</button>
- <button type="button" class="btn btn-outline-primary">Middle</button>
- <button type="button" class="btn btn-outline-primary">Right</button>
+ <button type="button" class="btn-outline theme-primary">Left</button>
+ <button type="button" class="btn-outline theme-primary">Middle</button>
+ <button type="button" class="btn-outline theme-primary">Right</button>
+ </div>
+ <div class="btn-group btn-group-xs" role="group" aria-label="Extra small button group">
+ <button type="button" class="btn-outline theme-primary">Left</button>
+ <button type="button" class="btn-outline theme-primary">Middle</button>
+ <button type="button" class="btn-outline theme-primary">Right</button>
</div>`} />
## Nesting
Place a `.btn-group` within another `.btn-group` when you want dropdown menus mixed with a series of buttons.
<Example code={`<div class="btn-group" role="group" aria-label="Button group with nested dropdown">
- <button type="button" class="btn btn-primary">1</button>
- <button type="button" class="btn btn-primary">2</button>
+ <button type="button" class="btn-solid theme-primary">1</button>
+ <button type="button" class="btn-solid theme-primary">2</button>
<div class="btn-group" role="group">
- <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
+ <button type="button" class="btn-solid theme-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown
</button>
<ul class="dropdown-menu">
Make a set of buttons appear vertically stacked rather than horizontally. **Split button dropdowns are not supported here.**
<Example code={`<div class="btn-group-vertical" role="group" aria-label="Vertical button group">
- <button type="button" class="btn btn-primary">Button</button>
- <button type="button" class="btn btn-primary">Button</button>
- <button type="button" class="btn btn-primary">Button</button>
- <button type="button" class="btn btn-primary">Button</button>
+ <button type="button" class="btn-solid theme-primary">Button</button>
+ <button type="button" class="btn-solid theme-primary">Button</button>
+ <button type="button" class="btn-solid theme-primary">Button</button>
+ <button type="button" class="btn-solid theme-primary">Button</button>
</div>`} />
<Example code={`<div class="btn-group-vertical" role="group" aria-label="Vertical button group">
<div class="btn-group" role="group">
- <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
+ <button type="button" class="btn-solid theme-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Dropdown link</a></li>
</ul>
</div>
- <button type="button" class="btn btn-primary">Button</button>
- <button type="button" class="btn btn-primary">Button</button>
+ <button type="button" class="btn-solid theme-primary">Button</button>
+ <button type="button" class="btn-solid theme-primary">Button</button>
<div class="btn-group dropstart" role="group">
- <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
+ <button type="button" class="btn-solid theme-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown
</button>
<ul class="dropdown-menu">
</ul>
</div>
<div class="btn-group dropend" role="group">
- <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
+ <button type="button" class="btn-solid theme-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown
</button>
<ul class="dropdown-menu">
</ul>
</div>
<div class="btn-group dropup" role="group">
- <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
+ <button type="button" class="btn-solid theme-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown
</button>
<ul class="dropdown-menu">