]> git.ipfire.org Git - ipfire.org.git/blob - src/scss/bootstrap-4.0.0-alpha.6/scss/_button-group.scss
.gitignore: Add .vscode
[ipfire.org.git] / src / scss / bootstrap-4.0.0-alpha.6 / scss / _button-group.scss
1 // scss-lint:disable QualifyingElement
2
3 // Make the div behave like a button
4 .btn-group,
5 .btn-group-vertical {
6 position: relative;
7 display: inline-flex;
8 vertical-align: middle; // match .btn alignment given font-size hack above
9
10 > .btn {
11 position: relative;
12 flex: 0 1 auto;
13
14 // Bring the hover, focused, and "active" buttons to the fron to overlay
15 // the borders properly
16 @include hover {
17 z-index: 2;
18 }
19 &:focus,
20 &:active,
21 &.active {
22 z-index: 2;
23 }
24 }
25
26 // Prevent double borders when buttons are next to each other
27 .btn + .btn,
28 .btn + .btn-group,
29 .btn-group + .btn,
30 .btn-group + .btn-group {
31 margin-left: -$input-btn-border-width;
32 }
33 }
34
35 // Optional: Group multiple button groups together for a toolbar
36 .btn-toolbar {
37 display: flex;
38 justify-content: flex-start;
39
40 .input-group {
41 width: auto;
42 }
43 }
44
45 .btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
46 border-radius: 0;
47 }
48
49 // Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match
50 .btn-group > .btn:first-child {
51 margin-left: 0;
52
53 &:not(:last-child):not(.dropdown-toggle) {
54 @include border-right-radius(0);
55 }
56 }
57 // Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu immediately after it
58 .btn-group > .btn:last-child:not(:first-child),
59 .btn-group > .dropdown-toggle:not(:first-child) {
60 @include border-left-radius(0);
61 }
62
63 // Custom edits for including btn-groups within btn-groups (useful for including dropdown buttons within a btn-group)
64 .btn-group > .btn-group {
65 float: left;
66 }
67 .btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {
68 border-radius: 0;
69 }
70 .btn-group > .btn-group:first-child:not(:last-child) {
71 > .btn:last-child,
72 > .dropdown-toggle {
73 @include border-right-radius(0);
74 }
75 }
76 .btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child {
77 @include border-left-radius(0);
78 }
79
80 // On active and open, don't show outline
81 .btn-group .dropdown-toggle:active,
82 .btn-group.open .dropdown-toggle {
83 outline: 0;
84 }
85
86
87 // Sizing
88 //
89 // Remix the default button sizing classes into new ones for easier manipulation.
90
91 .btn-group-sm > .btn { @extend .btn-sm; }
92 .btn-group-lg > .btn { @extend .btn-lg; }
93
94
95 //
96 // Split button dropdowns
97 //
98
99 .btn + .dropdown-toggle-split {
100 padding-right: $btn-padding-x * .75;
101 padding-left: $btn-padding-x * .75;
102
103 &::after {
104 margin-left: 0;
105 }
106 }
107
108 .btn-sm + .dropdown-toggle-split {
109 padding-right: $btn-padding-x-sm * .75;
110 padding-left: $btn-padding-x-sm * .75;
111 }
112
113 .btn-lg + .dropdown-toggle-split {
114 padding-right: $btn-padding-x-lg * .75;
115 padding-left: $btn-padding-x-lg * .75;
116 }
117
118
119 // The clickable button for toggling the menu
120 // Remove the gradient and set the same inset shadow as the :active state
121 .btn-group.open .dropdown-toggle {
122 @include box-shadow($btn-active-box-shadow);
123
124 // Show no shadow for `.btn-link` since it has no other button styles.
125 &.btn-link {
126 @include box-shadow(none);
127 }
128 }
129
130
131 //
132 // Vertical button groups
133 //
134
135 .btn-group-vertical {
136 display: inline-flex;
137 flex-direction: column;
138 align-items: flex-start;
139 justify-content: center;
140
141 .btn,
142 .btn-group {
143 width: 100%;
144 }
145
146 > .btn + .btn,
147 > .btn + .btn-group,
148 > .btn-group + .btn,
149 > .btn-group + .btn-group {
150 margin-top: -$input-btn-border-width;
151 margin-left: 0;
152 }
153 }
154
155 .btn-group-vertical > .btn {
156 &:not(:first-child):not(:last-child) {
157 border-radius: 0;
158 }
159 &:first-child:not(:last-child) {
160 @include border-bottom-radius(0);
161 }
162 &:last-child:not(:first-child) {
163 @include border-top-radius(0);
164 }
165 }
166 .btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {
167 border-radius: 0;
168 }
169 .btn-group-vertical > .btn-group:first-child:not(:last-child) {
170 > .btn:last-child,
171 > .dropdown-toggle {
172 @include border-bottom-radius(0);
173 }
174 }
175 .btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {
176 @include border-top-radius(0);
177 }
178
179
180 // Checkbox and radio options
181 //
182 // In order to support the browser's form validation feedback, powered by the
183 // `required` attribute, we have to "hide" the inputs via `clip`. We cannot use
184 // `display: none;` or `visibility: hidden;` as that also hides the popover.
185 // Simply visually hiding the inputs via `opacity` would leave them clickable in
186 // certain cases which is prevented by using `clip` and `pointer-events`.
187 // This way, we ensure a DOM element is visible to position the popover from.
188 //
189 // See https://github.com/twbs/bootstrap/pull/12794 and
190 // https://github.com/twbs/bootstrap/pull/14559 for more information.
191
192 [data-toggle="buttons"] {
193 > .btn,
194 > .btn-group > .btn {
195 input[type="radio"],
196 input[type="checkbox"] {
197 position: absolute;
198 clip: rect(0,0,0,0);
199 pointer-events: none;
200 }
201 }
202 }