Skip to content

Commit 0c5b729

Browse files
committed
Vertical support
1 parent dcd32c7 commit 0c5b729

2 files changed

Lines changed: 39 additions & 4 deletions

File tree

scss/buttons/_button-group.scss

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,40 @@
3333
> [class*="btn-"] + [class*="btn-"] {
3434
&::before {
3535
position: absolute;
36-
top: 25%;
37-
bottom: 25%;
38-
left: calc(var(--btn-border-width) * -1);
36+
// top: 25%;
37+
// bottom: 25%;
38+
// left: calc(var(--btn-border-width) * -1);
3939
z-index: 3;
40-
width: var(--btn-border-width);
40+
// width: var(--btn-border-width);
4141
content: "";
4242
background-color: var(--btn-color);
4343
opacity: .25;
4444
}
4545
}
4646
}
4747

48+
.btn-group:where(.btn-group-divider) {
49+
> [class*="btn-"] + [class*="btn-"] {
50+
&::before {
51+
top: 25%;
52+
bottom: 25%;
53+
left: calc(var(--btn-border-width) * -1);
54+
width: var(--btn-border-width);
55+
}
56+
}
57+
}
58+
59+
.btn-group-vertical:where(.btn-group-divider) {
60+
> [class*="btn-"] + [class*="btn-"] {
61+
&::before {
62+
top: calc(var(--btn-border-width) * -1);
63+
right: var(--btn-padding-x);
64+
left: var(--btn-padding-x);
65+
height: var(--btn-border-width);
66+
}
67+
}
68+
}
69+
4870
// Optional: Group multiple button groups together for a toolbar
4971
.btn-toolbar {
5072
display: flex;

site/src/content/docs/components/button-group.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ Add a divider between buttons by adding the `.btn-group-divider` class to the `.
4646
<button type="button" class="btn-solid theme-secondary">Right</button>
4747
</div>`} />
4848

49+
Works with vertical button groups, too.
50+
51+
<Example class="d-flex align-items-start gap-2" code={`<div class="btn-group-vertical btn-group-divider" role="group" aria-label="Basic example">
52+
<button type="button" class="btn-solid theme-primary">Left</button>
53+
<button type="button" class="btn-solid theme-primary active">Active</button>
54+
<button type="button" class="btn-solid theme-primary">Right</button>
55+
</div>
56+
57+
<div class="btn-group-vertical btn-group-divider" role="group" aria-label="Basic example">
58+
<button type="button" class="btn-solid theme-secondary">Left</button>
59+
<button type="button" class="btn-solid theme-secondary">Right</button>
60+
</div>`} />
61+
4962
## Theme variants
5063

5164
Ue the `.theme-{color}` classes to apply a theme color to a set of buttons.

0 commit comments

Comments
 (0)