1 @import 'mediawiki.mixins';
2 @import 'mediawiki.ui/variables';
6 // Primary buttons mixin
7 .button-colors-primary( @bgColor, @highlightColor, @activeColor ) {
8 background-color: @bgColor;
10 // border of the same color as background so that light background and
11 // dark background buttons are the same height and width
12 border: 1px solid @bgColor;
15 background-color: @highlightColor;
16 border-color: @highlightColor;
20 box-shadow: inset 0 0 0 1px @bgColor, inset 0 0 0 2px #fff;
25 background-color: @activeColor;
26 border-color: @activeColor;
31 background-color: @colorGray12;
33 border-color: @colorGray12;
35 // Make sure disabled buttons don't have hover and active states
38 background-color: @colorGray12;
40 border-color: @colorGray12;
46 // All buttons start with `.mw-ui-button` class, modified by other classes.
47 // It can be any element. Due to a lack of a CSS reset, the exact styling of
48 // the button depends on what type of element is used.
49 // There are two kinds of buttons, the default is a "Call to Action" with an obvious border
50 // and there is a quiet kind without a border.
54 // Neutral button styling
56 // These are the main actions on the page/workflow. The page should have only one of progressive and destructive buttons, the rest being quiet.
60 // <button class="mw-ui-button">.mw-ui-button</button>
63 // <button class="mw-ui-button" disabled>.mw-ui-button</button>
68 background-color: @colorGray15;
69 color: @colorButtonText;
71 display: inline-block;
72 .box-sizing( border-box );
74 max-width: 28.75em; // equivalent to 460px, @see T95367
76 padding: 0.546875em 1em;
77 border: @border-width-base @border-style-base @border-color-base;
78 border-radius: @borderRadius;
79 // Inherit the font rather than apply user agent stylesheet (T72072)
85 // Disable weird iOS styling
86 -webkit-appearance: none;
88 // https://stackoverflow.com/a/5838575/365238
89 *display: inline; /* stylelint-disable-line declaration-block-no-duplicate-properties */
91 // Ensure that buttons and inputs are nicely aligned when they have differing heights
92 vertical-align: middle;
93 // Interaction styling
96 // Make sure that `color` isn't inheriting from user-agent styles
98 color: @colorButtonText;
102 background-color: @background-color-base;
104 border-color: @colorGray10;
108 background-color: @background-color-base;
109 // Make sure that `color` isn't inheriting from user-agent styles
110 color: @colorButtonText;
111 border-color: @colorProgressive;
112 box-shadow: inset 0 0 0 1px @colorProgressive, inset 0 0 0 2px @background-color-base;
115 // Remove the inner border and padding in Firefox.
116 &::-moz-focus-inner {
117 border-color: transparent;
124 background-color: @colorGray12;
126 border-color: @colorGray7;
131 &.mw-ui-quiet.mw-ui-progressive,
132 &.mw-ui-quiet.mw-ui-destructive {
133 background-color: @colorGray12;
134 color: @colorBaseInverted;
135 border-color: @colorGray12;
138 // Make sure disabled buttons don't have hover and active states
141 background-color: @colorGray12;
142 color: @colorBaseInverted;
144 border-color: @colorGray12;
148 // `:not()` is used exclusively for `transition`s as both are not supported by IE < 9
150 .transition( ~'background-color 100ms, color 100ms, border-color 100ms, box-shadow 100ms' );
153 // Styling for specific button types
154 // -----------------------------------------
158 // 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.
159 // Its use is not recommended on mobile/tablet due to lack of hover state.
163 // <button class="mw-ui-button mw-ui-quiet">.mw-ui-button</button>
166 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet">.mw-ui-destructive</button>
169 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet" disabled>.mw-ui-destructive</button>
172 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet">.mw-ui-progressive</button>
175 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet" disabled>.mw-ui-progressive</button>
180 background-color: transparent;
181 // Quiet buttons all start gray, and reveal
182 // progressive/destructive color on hover and active.
183 color: @colorButtonText;
184 border-color: transparent;
187 background-color: transparent;
188 color: @colorButtonTextHighlight;
189 border-color: transparent;
194 background-color: transparent;
195 color: @colorButtonTextActive;
196 border-color: transparent;
200 background-color: transparent;
201 color: @colorButtonText;
202 border-color: transparent;
207 background-color: transparent;
208 color: @colorDisabledText;
209 border-color: transparent;
213 // Progressive buttons
215 // Use progressive buttons for actions which lead to a next step in the process.
219 // <button class="mw-ui-button mw-ui-progressive">.mw-ui-progressive</button>
222 // <button class="mw-ui-button mw-ui-progressive" disabled>.mw-ui-progressive</button>
226 &.mw-ui-progressive {
227 .button-colors-primary( @colorProgressive, @colorProgressiveHighlight, @colorProgressiveActive );
230 color: @colorProgressive;
233 background-color: transparent;
234 color: @colorProgressiveHighlight;
238 color: @colorProgressiveActive;
242 background-color: transparent;
243 color: @colorProgressive;
248 // Destructive buttons
250 // Use destructive buttons for actions that remove or limit, such as deleting a page or blocking a user.
251 // This should not be used for cancel buttons.
255 // <button class="mw-ui-button mw-ui-destructive">.mw-ui-destructive</button>
258 // <button class="mw-ui-button mw-ui-destructive" disabled>.mw-ui-destructive</button>
262 &.mw-ui-destructive {
263 .button-colors-primary( @colorDestructive, @colorDestructiveHighlight, @colorDestructiveActive );
266 color: @colorDestructive;
269 background-color: transparent;
270 color: @colorDestructiveHighlight;
274 color: @colorDestructiveActive;
278 background-color: transparent;
279 color: @colorDestructive;
286 // Not all buttons are equal. You can emphasise certain actions over others
287 // using the mw-ui-big class.
291 // <button class="mw-ui-button mw-ui-big">.mw-ui-button</button>
294 // <button class="mw-ui-button mw-ui-progressive mw-ui-big">.mw-ui-progressive</button>
297 // <button class="mw-ui-button mw-ui-destructive mw-ui-big">.mw-ui-destructive</button>
307 // Some buttons might need to be stacked.
311 // <button class="mw-ui-button mw-ui-block">.mw-ui-button</button>
314 // <button class="mw-ui-button mw-ui-progressive mw-ui-block">.mw-ui-progressive</button>
317 // <button class="mw-ui-button mw-ui-destructive mw-ui-block">.mw-ui-destructive</button>
330 button.mw-ui-button {
331 // Buttons in Firefox have extra height
332 &::-moz-focus-inner {
339 text-decoration: none;
341 // This overrides an underline declaration on a:hover and a:focus in
342 // commonElements.css, which the class alone isn't specific enough to do.
345 text-decoration: none;
351 // Group of buttons. Make sure you clear the floating after using a mw-ui-button-group.
354 // <div class="mw-ui-button-group">
355 // <div class="mw-ui-button is-on">A</div>
356 // <div class="mw-ui-button">B</div>
357 // <div class="mw-ui-button">C</div>
358 // <div class="mw-ui-button">D</div>
359 // </div><div style="clear:both"></div>
362 .mw-ui-button-group {
369 border-top-left-radius: @borderRadius;
370 border-bottom-left-radius: @borderRadius;
373 &:not( :first-child ) {
378 border-top-right-radius: @borderRadius;
379 border-bottom-right-radius: @borderRadius;