1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
// stylelint-disable custom-property-empty-line-before
//
// Base styles
//
.btn {
// scss-docs-start btn-css-vars
--#{$variable-prefix}btn-padding-x: #{$btn-padding-x};
--#{$variable-prefix}btn-padding-y: #{$btn-padding-y};
--#{$variable-prefix}btn-font-family: #{$btn-font-family};
@include rfs($btn-font-size, --#{$variable-prefix}btn-font-size);
--#{$variable-prefix}btn-font-weight: #{$btn-font-weight};
--#{$variable-prefix}btn-line-height: #{$btn-line-height};
--#{$variable-prefix}btn-color: #{$body-color};
--#{$variable-prefix}btn-bg: transparent;
--#{$variable-prefix}btn-border-width: #{$btn-border-width};
--#{$variable-prefix}btn-border-color: transparent;
--#{$variable-prefix}btn-border-radius: #{$btn-border-radius};
--#{$variable-prefix}btn-box-shadow: #{$btn-box-shadow};
--#{$variable-prefix}btn-disabled-opacity: #{$btn-disabled-opacity};
--#{$variable-prefix}btn-focus-box-shadow: 0 0 0 #{$btn-focus-width} rgba(var(--#{$variable-prefix}btn-focus-shadow-rgb), .5);
// scss-docs-end btn-css-vars
display: inline-block;
padding: var(--#{$variable-prefix}btn-padding-y) var(--#{$variable-prefix}btn-padding-x);
font-family: var(--#{$variable-prefix}btn-font-family);
font-size: var(--#{$variable-prefix}btn-font-size);
font-weight: var(--#{$variable-prefix}btn-font-weight);
line-height: var(--#{$variable-prefix}btn-line-height);
color: var(--#{$variable-prefix}btn-color);
text-align: center;
text-decoration: if($link-decoration == none, null, none);
white-space: $btn-white-space;
vertical-align: middle;
cursor: if($enable-button-pointers, pointer, null);
user-select: none;
border: var(--#{$variable-prefix}btn-border-width) solid var(--#{$variable-prefix}btn-border-color);
@include border-radius(var(--#{$variable-prefix}btn-border-radius));
@include gradient-bg(var(--#{$variable-prefix}btn-bg));
@include box-shadow(var(--#{$variable-prefix}btn-box-shadow));
@include transition($btn-transition);
&:hover {
color: var(--#{$variable-prefix}btn-hover-color);
text-decoration: if($link-hover-decoration == underline, none, null);
background-color: var(--#{$variable-prefix}btn-hover-bg);
border-color: var(--#{$variable-prefix}btn-hover-border-color);
}
.btn-check:focus + &,
&:focus {
color: var(--#{$variable-prefix}btn-hover-color);
@include gradient-bg(var(--#{$variable-prefix}btn-hover-bg));
border-color: var(--#{$variable-prefix}btn-hover-border-color);
outline: 0;
// Avoid using mixin so we can pass custom focus shadow properly
@if $enable-shadows {
box-shadow: var(--#{$variable-prefix}btn-box-shadow), var(--#{$variable-prefix}btn-focus-box-shadow);
} @else {
box-shadow: var(--#{$variable-prefix}btn-focus-box-shadow);
}
}
.btn-check:checked + &,
.btn-check:active + &,
&:active,
&.active,
&.show {
color: var(--#{$variable-prefix}btn-active-color);
background-color: var(--#{$variable-prefix}btn-active-bg);
// Remove CSS gradients if they're enabled
background-image: if($enable-gradients, none, null);
border-color: var(--#{$variable-prefix}btn-active-border-color);
@include box-shadow(var(--#{$variable-prefix}btn-active-shadow));
&:focus {
// Avoid using mixin so we can pass custom focus shadow properly
@if $enable-shadows {
box-shadow: var(--#{$variable-prefix}btn-active-shadow), var(--#{$variable-prefix}btn-focus-box-shadow);
} @else {
box-shadow: var(--#{$variable-prefix}btn-focus-box-shadow);
}
}
}
&:disabled,
&.disabled,
fieldset:disabled & {
color: var(--#{$variable-prefix}btn-disabled-color);
pointer-events: none;
background-color: var(--#{$variable-prefix}btn-disabled-bg);
background-image: if($enable-gradients, none, null);
border-color: var(--#{$variable-prefix}btn-disabled-border-color);
opacity: var(--#{$variable-prefix}btn-disabled-opacity);
@include box-shadow(none);
}
}
//
// Alternate buttons
//
// scss-docs-start btn-variant-loops
@each $color, $value in $theme-colors {
.btn-#{$color} {
@include button-variant($value, $value);
}
}
@each $color, $value in $theme-colors {
.btn-outline-#{$color} {
@include button-outline-variant($value);
}
}
// scss-docs-end btn-variant-loops
//
// Link buttons
//
// Make a button look and behave like a link
.btn-link {
--#{$variable-prefix}btn-font-weight: #{$font-weight-normal};
--#{$variable-prefix}btn-color: #{$btn-link-color};
--#{$variable-prefix}btn-bg: transparent;
--#{$variable-prefix}btn-border-color: transparent;
--#{$variable-prefix}btn-hover-color: #{$btn-link-hover-color};
--#{$variable-prefix}btn-hover-border-color: transparent;
--#{$variable-prefix}btn-active-border-color: transparent;
--#{$variable-prefix}btn-disabled-color: #{$btn-link-disabled-color};
--#{$variable-prefix}btn-disabled-border-color: transparent;
--#{$variable-prefix}btn-box-shadow: none;
text-decoration: $link-decoration;
&:hover,
&:focus {
text-decoration: $link-hover-decoration;
}
// No need for an active state here
}
//
// Button Sizes
//
.btn-lg {
@include button-size($btn-padding-y-lg, $btn-padding-x-lg, $btn-font-size-lg, $btn-border-radius-lg);
}
.btn-sm {
@include button-size($btn-padding-y-sm, $btn-padding-x-sm, $btn-font-size-sm, $btn-border-radius-sm);
}
|