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, constructive and desctructive 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 (bug 70072)
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
49 // Ensure that buttons and inputs are nicely aligned when they have differing heights
50 vertical-align: middle;
53 .button-colors( #fff, @colorGray12, @colorGray7 );
57 // Interaction styling
65 // Styling for specific button types
66 // -----------------------------------------
70 // Not all buttons are equal. You can emphasise certain actions over others
71 // using the mw-ui-big class.
75 // <button class="mw-ui-button mw-ui-big">.mw-ui-button</button>
78 // <button class="mw-ui-button mw-ui-progressive mw-ui-big">.mw-ui-progressive</button>
81 // <button class="mw-ui-button mw-ui-constructive mw-ui-big">.mw-ui-constructive</button>
84 // <button class="mw-ui-button mw-ui-destructive mw-ui-big">.mw-ui-destructive</button>
94 // Some buttons might need to be stacked.
98 // <button class="mw-ui-button mw-ui-block">.mw-ui-button</button>
101 // <button class="mw-ui-button mw-ui-progressive mw-ui-block">.mw-ui-progressive</button>
104 // <button class="mw-ui-button mw-ui-constructive mw-ui-block">.mw-ui-constructive</button>
107 // <button class="mw-ui-button mw-ui-destructive mw-ui-block">.mw-ui-destructive</button>
118 // Progressive buttons
120 // Use progressive buttons for actions which lead to a next step in the process.
121 // .mw-ui-primary is deprecated, kept for compatibility.
125 // <button class="mw-ui-button mw-ui-progressive">.mw-ui-progressive</button>
128 // <button class="mw-ui-button mw-ui-progressive" disabled>.mw-ui-progressive</button>
134 .button-colors( @colorProgressive, @colorProgressiveHighlight, @colorProgressiveActive );
137 .button-colors-quiet( @colorProgressive, @colorProgressiveHighlight, @colorProgressiveActive );
141 // Constructive buttons
143 // Use constructive buttons for actions which result in a final action in the process that results
144 // in a change of state.
145 // e.g. save changes button
149 // <button class="mw-ui-button mw-ui-constructive">.mw-ui-constructive</button>
152 // <button class="mw-ui-button mw-ui-constructive" disabled>.mw-ui-constructive</button>
156 &.mw-ui-constructive {
157 .button-colors( @colorConstructive, @colorConstructiveHighlight, @colorConstructiveActive );
160 .button-colors-quiet( @colorConstructive, @colorConstructiveHighlight, @colorConstructiveActive );
164 // Destructive buttons
166 // Use destructive buttons for actions that remove or limit, such as deleting a page or blocking a user.
167 // This should not be used for cancel buttons.
171 // <button class="mw-ui-button mw-ui-destructive">.mw-ui-destructive</button>
174 // <button class="mw-ui-button mw-ui-destructive" disabled>.mw-ui-destructive</button>
178 &.mw-ui-destructive {
179 .button-colors( @colorDestructive, @colorDestructiveHighlight, @colorDestructiveActive );
182 .button-colors-quiet( @colorDestructive, @colorDestructiveHighlight, @colorDestructiveActive );
188 // Use quiet buttons when they are less important and alongside other constructive, progressive or destructive buttons. It should be used for an action that exits the user from the current view/workflow.
189 // Its use is not recommended on mobile/tablet due to lack of hover state.
193 // <button class="mw-ui-button mw-ui-quiet">.mw-ui-button</button>
196 // <button class="mw-ui-button mw-ui-constructive mw-ui-quiet">.mw-ui-constructive</button>
199 // <button class="mw-ui-button mw-ui-constructive mw-ui-quiet" disabled>.mw-ui-constructive</button>
202 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet">.mw-ui-destructive</button>
205 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet" disabled>.mw-ui-destructive</button>
208 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet">.mw-ui-progressive</button>
211 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet" disabled>.mw-ui-progressive</button>
216 background: transparent;
219 .button-colors-quiet( @colorButtonText, @colorButtonTextHighlight, @colorButtonTextActive );
228 background: transparent;
234 text-decoration: none;
236 // This overrides an underline declaration on a:hover and a:focus in
237 // commonElements.css, which the class alone isn't specific enough to do.
240 text-decoration: none;
243 // a-tags behave different to inputs if the line-height attribute is inherited
244 // from another element (e.g. mw-body-content). They appear bigger as input
245 // tags. See Bug T116427. To fix that, apply the correct line-height (used
246 // for inputs) to a-tags, too.
252 // Group of buttons. Make sure you clear the floating after using a mw-ui-button-group.
255 // <div class="mw-ui-button-group">
256 // <div class="mw-ui-button">A</div>
257 // <div class="mw-ui-button">B</div>
258 // <div class="mw-ui-button">C</div>
259 // <div class="mw-ui-button">D</div>
260 // </div><div style="clear:both"></div>
263 .mw-ui-button-group > * {
269 border-top-left-radius: @borderRadius;
270 border-bottom-left-radius: @borderRadius;
273 &:not( :first-child ) {
278 border-top-right-radius: @borderRadius;
279 border-bottom-right-radius: @borderRadius;