From: Mark Otto Date: Tue, 7 Apr 2026 21:04:10 +0000 (-0700) Subject: Button group dividers (#42284) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1544aebcd4687af50715e61431180e8ac9b349d;p=thirdparty%2Fbootstrap.git Button group dividers (#42284) * Add optional dividers to btn groups * Add another example, add active state * Vertical support * bump bw --- diff --git a/.bundlewatch.config.json b/.bundlewatch.config.json index 7d1e7bd3f1..4b0a5ce0b3 100644 --- a/.bundlewatch.config.json +++ b/.bundlewatch.config.json @@ -26,7 +26,7 @@ }, { "path": "./dist/css/bootstrap.css", - "maxSize": "47.75 kB" + "maxSize": "48.0 kB" }, { "path": "./dist/css/bootstrap.min.css", diff --git a/scss/buttons/_button-group.scss b/scss/buttons/_button-group.scss index 7f3da8fdb7..0a86f95e4e 100644 --- a/scss/buttons/_button-group.scss +++ b/scss/buttons/_button-group.scss @@ -29,6 +29,44 @@ } } + .btn-group-divider { + > [class*="btn-"] + [class*="btn-"] { + &::before { + position: absolute; + // top: 25%; + // bottom: 25%; + // left: calc(var(--btn-border-width) * -1); + z-index: 3; + // width: var(--btn-border-width); + content: ""; + background-color: var(--btn-color); + opacity: .25; + } + } + } + + .btn-group:where(.btn-group-divider) { + > [class*="btn-"] + [class*="btn-"] { + &::before { + top: 25%; + bottom: 25%; + left: calc(var(--btn-border-width) * -1); + width: var(--btn-border-width); + } + } + } + + .btn-group-vertical:where(.btn-group-divider) { + > [class*="btn-"] + [class*="btn-"] { + &::before { + top: calc(var(--btn-border-width) * -1); + right: var(--btn-padding-x); + left: var(--btn-padding-x); + height: var(--btn-border-width); + } + } + } + // Optional: Group multiple button groups together for a toolbar .btn-toolbar { display: flex; diff --git a/site/src/content/docs/components/button-group.mdx b/site/src/content/docs/components/button-group.mdx index 56ffb190e2..5ee578dce9 100644 --- a/site/src/content/docs/components/button-group.mdx +++ b/site/src/content/docs/components/button-group.mdx @@ -7,7 +7,7 @@ deps: - title: Buttons --- -## Basic example +## Examples Wrap a series of buttons in `.btn-group`. @@ -21,6 +21,8 @@ Wrap a series of buttons in `.btn-group`. Button groups require an appropriate `role` attribute and explicit label to ensure assistive technologies like screen readers identify buttons as grouped and announce them. Use `role="group"` for button groups or `role="toolbar"` for button toolbars. Then use `aria-label` or `aria-labelledby` to label them. +### With links + These classes can also be added to groups of links, as an alternative to the [`.nav` navigation components]([[docsref:/components/nav]]). @@ -29,7 +31,45 @@ These classes can also be added to groups of links, as an alternative to the [`. Link `} /> -## Mixed variants +### Dividers + +Add a divider between buttons by adding the `.btn-group-divider` class to the `.btn-group`. Most useful when used with buttons that have the same theme color and a solid fill. + + + + + + + +
+ + +
`} /> + +Works with vertical button groups, too. + + + + + + + +
+ + +
`} /> + +## Theme variants + +Ue the `.theme-{color}` classes to apply a theme color to a set of buttons. + + + + + + `} /> + +You can mix and match button variants in a button group. @@ -37,14 +77,28 @@ These classes can also be added to groups of links, as an alternative to the [`. `} /> -## Outline buttons +## Style variants + +All button styles are supported in button groups. Mix and match with the `.btn-group-divider` class to add dividers between some styles or just use the button borders in others. - + + + + + `} /> + + `} /> + + + + + `} /> + ## Toggle buttons ### Checkbox