UNPKG

4.6 kBSCSSView Raw
1@import "../../themes/ionic.globals";
2
3// Floating Action Buttons
4// --------------------------------------------------
5
6/// @prop - Width and height of the FAB button
7$fab-size: 56px !default;
8
9/// @prop - Width and height of the FAB button mini
10$fab-mini-size: 40px !default;
11
12/// @prop - Margin of the FAB Container
13$fab-content-margin: 10px !default;
14
15/// @prop - Margin of the FAB List
16$fab-list-margin: 10px !default;
17
18/// @prop - Background color of the button in a list
19$fab-list-button-background-color: #f4f4f4 !default;
20
21
22.fab {
23 @include text-align(center);
24 @include appearance(none);
25 @include border-radius(50%);
26
27 position: relative;
28 z-index: 0;
29 display: block;
30 overflow: hidden;
31
32 width: $fab-size;
33 height: $fab-size;
34
35 font-size: 14px;
36 line-height: $fab-size;
37 text-overflow: ellipsis;
38 text-transform: none;
39 white-space: nowrap;
40 cursor: pointer;
41 transition: background-color, opacity 100ms linear;
42
43 background-clip: padding-box;
44 font-kerning: none;
45 user-select: none;
46
47 contain: strict;
48}
49
50.fab ion-icon {
51 flex: 1;
52
53 font-size: 2.4rem;
54}
55
56// FAB mini
57// --------------------------------------------------
58
59.fab[mini] {
60 @include margin(($fab-size - $fab-mini-size) / 2);
61
62 width: $fab-mini-size;
63 height: $fab-mini-size;
64
65 line-height: $fab-mini-size;
66}
67
68.fab[mini] .fab-close-icon {
69 line-height: $fab-mini-size;
70}
71
72
73// FAB container
74// --------------------------------------------------
75
76ion-fab {
77 position: absolute;
78 z-index: $z-index-fixed-content;
79
80 &[center] {
81 @include position(null, null, null, 50%);
82 @include margin-horizontal(-$fab-size / 2, null);
83 }
84
85 &[middle] {
86 @include margin(-$fab-size / 2, null, null, null);
87
88 top: 50%;
89 }
90
91 &[top] {
92 top: $fab-content-margin;
93 }
94
95 &[right] {
96 // scss-lint:disable PropertySpelling
97 @include multi-dir() {
98 right: $fab-content-margin;
99 }
100
101 @include multi-dir() {
102 right: calc(#{$fab-content-margin} + constant(safe-area-inset-right));
103 right: calc(#{$fab-content-margin} + env(safe-area-inset-right));
104 }
105 }
106
107 &[end] {
108 @include position-horizontal(null, $fab-content-margin);
109 @include safe-position-horizontal(null, $fab-content-margin);
110 }
111
112 &[bottom] {
113 bottom: $fab-content-margin;
114 }
115
116 &[left] {
117 // scss-lint:disable PropertySpelling
118 @include multi-dir() {
119 left: $fab-content-margin;
120 }
121
122 @include multi-dir() {
123 left: calc(#{$fab-content-margin} + constant(safe-area-inset-left));
124 left: calc(#{$fab-content-margin} + env(safe-area-inset-left));
125 }
126 }
127
128 &[start] {
129 @include position-horizontal($fab-content-margin, null);
130 @include safe-position-horizontal($fab-content-margin, null);
131 }
132
133 &[top][edge] {
134 top: -$fab-size / 2;
135 }
136
137 &[bottom][edge] {
138 bottom: -$fab-size / 2;
139 }
140}
141
142
143// FAB list (speed dial)
144// --------------------------------------------------
145
146ion-fab-list {
147 @include margin($fab-size + $fab-list-margin, 0);
148
149 position: absolute;
150 top: 0;
151 display: none;
152
153 flex-direction: column;
154 align-items: center;
155
156 min-width: $fab-size;
157 min-height: $fab-size;
158}
159
160.fab-in-list {
161 @include margin(8px, 0);
162
163 width: $fab-mini-size;
164 height: $fab-mini-size;
165
166 opacity: 0;
167 visibility: hidden;
168 transform: scale(0);
169}
170
171.fab-in-list.show {
172 opacity: 1;
173 visibility: visible;
174 transform: scale(1);
175}
176
177ion-fab-list[side=left] .fab-in-list,
178ion-fab-list[side=right] .fab-in-list {
179 @include margin(0, 8px);
180}
181
182ion-fab-list[side=top] {
183 top: auto;
184 bottom: 0;
185
186 flex-direction: column-reverse;
187}
188
189ion-fab-list[side=left] {
190 @include margin(0, $fab-size + $fab-list-margin);
191 @include position-horizontal(null, 0);
192
193 flex-direction: row-reverse;
194}
195
196ion-fab-list[side=right] {
197 @include margin(0, $fab-size + $fab-list-margin);
198 @include position(null, null, null, 0);
199
200 flex-direction: row;
201}
202
203
204// FAB animation
205// --------------------------------------------------
206
207.fab-list-active {
208 display: flex;
209}
210
211.fab-close-icon {
212 @include position(0, 0, null, 0);
213
214 position: absolute;
215
216 line-height: $fab-size;
217 opacity: 0;
218 transform: scale(.4) rotateZ(-45deg);
219 transition: all ease-in-out 300ms;
220 transition-property: transform, opacity;
221}
222
223.fab .button-inner {
224 transition: all ease-in-out 300ms;
225 transition-property: transform, opacity;
226}
227
228.fab-close-active .fab-close-icon {
229 opacity: 1;
230 transform: scale(1) rotateZ(0deg);
231}
232
233.fab-close-active .button-inner {
234 opacity: 0;
235 transform: scale(.4) rotateZ(45deg);
236}