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 // Inherit the font rather than apply user agent stylesheet (T72072)
33 display: inline-block;
35 max-width: 28.75em; // equivalent to 460px, @see T95367
38 border-radius: @borderRadius;
39 .box-sizing( border-box );
41 // Disable weird iOS styling
42 -webkit-appearance: none;
45 // https://stackoverflow.com/a/5838575/365238
46 *display: inline; /* stylelint-disable-line declaration-block-no-duplicate-properties */
49 // Ensure that buttons and inputs are nicely aligned when they have differing heights
50 vertical-align: middle;
53 .button-colors( @colorGray15, #fff, #d9d9d9 );
57 // Interaction styling
63 // Remove the inner border and padding in Firefox.
65 border-color: transparent;
70 // `:not()` is used exclusively for `transition`s as both are not supported by IE < 9
72 .transition( ~'background-color 100ms, color 100ms, border-color 100ms, box-shadow 100ms' );
80 // Styling for specific button types
81 // -----------------------------------------
85 // Not all buttons are equal. You can emphasise certain actions over others
86 // using the mw-ui-big class.
90 // <button class="mw-ui-button mw-ui-big">.mw-ui-button</button>
93 // <button class="mw-ui-button mw-ui-progressive mw-ui-big">.mw-ui-progressive</button>
96 // <button class="mw-ui-button mw-ui-destructive mw-ui-big">.mw-ui-destructive</button>
106 // Some buttons might need to be stacked.
110 // <button class="mw-ui-button mw-ui-block">.mw-ui-button</button>
113 // <button class="mw-ui-button mw-ui-progressive mw-ui-block">.mw-ui-progressive</button>
116 // <button class="mw-ui-button mw-ui-destructive mw-ui-block">.mw-ui-destructive</button>
127 // Progressive buttons
129 // Use progressive buttons for actions which lead to a next step in the process.
130 // .mw-ui-constructive is deprecated; consolidated with `progressive`, see T110555
134 // <button class="mw-ui-button mw-ui-progressive">.mw-ui-progressive</button>
137 // <button class="mw-ui-button mw-ui-progressive" disabled>.mw-ui-progressive</button>
142 &.mw-ui-constructive {
143 .button-colors-primary( @colorProgressive, @colorProgressiveHighlight, @colorProgressiveActive );
146 .button-colors-quiet( @colorProgressive, @colorProgressiveHighlight, @colorProgressiveActive );
150 // Destructive buttons
152 // Use destructive buttons for actions that remove or limit, such as deleting a page or blocking a user.
153 // This should not be used for cancel buttons.
157 // <button class="mw-ui-button mw-ui-destructive">.mw-ui-destructive</button>
160 // <button class="mw-ui-button mw-ui-destructive" disabled>.mw-ui-destructive</button>
164 &.mw-ui-destructive {
165 .button-colors-primary( @colorDestructive, @colorDestructiveHighlight, @colorDestructiveActive );
168 .button-colors-quiet( @colorDestructive, @colorDestructiveHighlight, @colorDestructiveActive );
174 // 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.
175 // Its use is not recommended on mobile/tablet due to lack of hover state.
179 // <button class="mw-ui-button mw-ui-quiet">.mw-ui-button</button>
182 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet">.mw-ui-destructive</button>
185 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet" disabled>.mw-ui-destructive</button>
188 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet">.mw-ui-progressive</button>
191 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet" disabled>.mw-ui-progressive</button>
196 background: transparent;
199 .button-colors-quiet( @colorButtonText, @colorButtonTextHighlight, @colorButtonTextActive );
208 background: transparent;
214 text-decoration: none;
216 // This overrides an underline declaration on a:hover and a:focus in
217 // commonElements.css, which the class alone isn't specific enough to do.
220 text-decoration: none;
223 // a-tags behave different to inputs if the line-height attribute is inherited
224 // from another element (e.g. mw-body-content). They appear bigger as input
225 // tags. See Bug T116427. To fix that, apply the correct line-height (used
226 // for inputs) to a-tags, too.
232 // Group of buttons. Make sure you clear the floating after using a mw-ui-button-group.
235 // <div class="mw-ui-button-group">
236 // <div class="mw-ui-button is-on">A</div>
237 // <div class="mw-ui-button">B</div>
238 // <div class="mw-ui-button">C</div>
239 // <div class="mw-ui-button">D</div>
240 // </div><div style="clear:both"></div>
243 .mw-ui-button-group {
250 border-top-left-radius: @borderRadius;
251 border-bottom-left-radius: @borderRadius;
254 &:not( :first-child ) {
259 border-top-right-radius: @borderRadius;
260 border-bottom-right-radius: @borderRadius;