1 @import 'mediawiki.mixins';
2 @import 'mediawiki.ui/variables';
3 @import 'mediawiki.ui/mixins';
7 // All buttons start with mw-ui-button class, modified by other classes.
8 // It can be any element. Due to a lack of a CSS reset, the exact styling of
9 // the button depends on what type of element is used.
10 // There are two kinds of buttons, the default is a "Call to Action" with an obvious border
11 // and there is a quiet kind without a border.
15 // Neutral button styling
17 // These are the main actions on the page/workflow. The page should have only one of progressive and destructive buttons, the rest being quiet.
21 // <button class="mw-ui-button">.mw-ui-button</button>
24 // <button class="mw-ui-button" disabled>.mw-ui-button</button>
29 background-color: @colorGray15;
30 color: @colorButtonText;
32 display: inline-block;
33 .box-sizing( border-box );
35 max-width: 28.75em; // equivalent to 460px, @see T95367
37 padding: 0.546875em 1em;
38 border: @border-width-base @border-style-base @border-color-base;
39 border-radius: @borderRadius;
40 // Inherit the font rather than apply user agent stylesheet (T72072)
46 // Disable weird iOS styling
47 -webkit-appearance: none;
49 // https://stackoverflow.com/a/5838575/365238
50 *display: inline; /* stylelint-disable-line declaration-block-no-duplicate-properties */
52 // Ensure that buttons and inputs are nicely aligned when they have differing heights
53 vertical-align: middle;
54 // Interaction styling
57 // Make sure that `color` isn't inheriting from user-agent styles
59 color: @colorButtonText;
63 background-color: @background-color-base;
65 border-color: @colorGray10;
69 background-color: @background-color-base;
70 // Make sure that `color` isn't inheriting from user-agent styles
71 color: @colorButtonText;
72 border-color: @colorProgressive;
73 box-shadow: inset 0 0 0 1px @colorProgressive, inset 0 0 0 2px @background-color-base;
76 // Remove the inner border and padding in Firefox.
78 border-color: transparent;
86 background-color: @colorGray12;
88 border-color: @colorGray7;
93 &.mw-ui-quiet.mw-ui-progressive,
94 &.mw-ui-quiet.mw-ui-destructive {
95 background-color: @colorGray12;
96 color: @colorBaseInverted;
97 border-color: @colorGray12;
100 // Make sure disabled buttons don't have hover and active states
103 background-color: @colorGray12;
104 color: @colorBaseInverted;
106 border-color: @colorGray12;
110 // `:not()` is used exclusively for `transition`s as both are not supported by IE < 9
112 .transition( ~'background-color 100ms, color 100ms, border-color 100ms, box-shadow 100ms' );
115 // Styling for specific button types
116 // -----------------------------------------
120 // Use quiet buttons when they are less important and alongside other progressive or destructive buttons. It should be used for an action that exits the user from the current view/workflow.
121 // Its use is not recommended on mobile/tablet due to lack of hover state.
125 // <button class="mw-ui-button mw-ui-quiet">.mw-ui-button</button>
128 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet">.mw-ui-destructive</button>
131 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet" disabled>.mw-ui-destructive</button>
134 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet">.mw-ui-progressive</button>
137 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet" disabled>.mw-ui-progressive</button>
142 background-color: transparent;
143 // Quiet buttons all start gray, and reveal
144 // progressive/destructive color on hover and active.
145 color: @colorButtonText;
146 border-color: transparent;
149 background-color: transparent;
150 color: @colorButtonTextHighlight;
151 border-color: transparent;
157 background-color: transparent;
158 color: @colorButtonTextActive;
159 border-color: transparent;
163 background-color: transparent;
164 color: @colorButtonText;
165 border-color: transparent;
170 background-color: transparent;
171 color: @colorDisabledText;
172 border-color: transparent;
176 // Progressive buttons
178 // Use progressive buttons for actions which lead to a next step in the process.
182 // <button class="mw-ui-button mw-ui-progressive">.mw-ui-progressive</button>
185 // <button class="mw-ui-button mw-ui-progressive" disabled>.mw-ui-progressive</button>
189 &.mw-ui-progressive {
190 .button-colors-primary( @colorProgressive, @colorProgressiveHighlight, @colorProgressiveActive );
193 color: @colorProgressive;
196 background-color: transparent;
197 color: @colorProgressiveHighlight;
202 color: @colorProgressiveActive;
206 background-color: transparent;
207 color: @colorProgressive;
212 // Destructive buttons
214 // Use destructive buttons for actions that remove or limit, such as deleting a page or blocking a user.
215 // This should not be used for cancel buttons.
219 // <button class="mw-ui-button mw-ui-destructive">.mw-ui-destructive</button>
222 // <button class="mw-ui-button mw-ui-destructive" disabled>.mw-ui-destructive</button>
226 &.mw-ui-destructive {
227 .button-colors-primary( @colorDestructive, @colorDestructiveHighlight, @colorDestructiveActive );
230 color: @colorDestructive;
233 background-color: transparent;
234 color: @colorDestructiveHighlight;
239 color: @colorDestructiveActive;
243 background-color: transparent;
244 color: @colorDestructive;
251 // Not all buttons are equal. You can emphasise certain actions over others
252 // using the mw-ui-big class.
256 // <button class="mw-ui-button mw-ui-big">.mw-ui-button</button>
259 // <button class="mw-ui-button mw-ui-progressive mw-ui-big">.mw-ui-progressive</button>
262 // <button class="mw-ui-button mw-ui-destructive mw-ui-big">.mw-ui-destructive</button>
272 // Some buttons might need to be stacked.
276 // <button class="mw-ui-button mw-ui-block">.mw-ui-button</button>
279 // <button class="mw-ui-button mw-ui-progressive mw-ui-block">.mw-ui-progressive</button>
282 // <button class="mw-ui-button mw-ui-destructive mw-ui-block">.mw-ui-destructive</button>
295 button.mw-ui-button {
296 // Buttons in Firefox have extra height
297 &::-moz-focus-inner {
304 text-decoration: none;
306 // This overrides an underline declaration on a:hover and a:focus in
307 // commonElements.css, which the class alone isn't specific enough to do.
310 text-decoration: none;
316 // Group of buttons. Make sure you clear the floating after using a mw-ui-button-group.
319 // <div class="mw-ui-button-group">
320 // <div class="mw-ui-button is-on">A</div>
321 // <div class="mw-ui-button">B</div>
322 // <div class="mw-ui-button">C</div>
323 // <div class="mw-ui-button">D</div>
324 // </div><div style="clear:both"></div>
327 .mw-ui-button-group {
334 border-top-left-radius: @borderRadius;
335 border-bottom-left-radius: @borderRadius;
338 &:not( :first-child ) {
343 border-top-right-radius: @borderRadius;
344 border-bottom-right-radius: @borderRadius;