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;
36 .box-sizing( border-box );
38 // Disable weird iOS styling
39 -webkit-appearance: none;
42 // https://stackoverflow.com/a/5838575/365238
47 .button-colors( #fff, #ccc, #777 );
48 border-radius: @borderRadius;
51 // Ensure that buttons and inputs are nicely aligned when they have differing heights
52 vertical-align: middle;
58 // Interaction styling
66 // Styling for specific button types
67 // -----------------------------------------
71 // Not all buttons are equal. You can emphasise certain actions over others
72 // using the mw-ui-big class.
76 // <button class="mw-ui-button mw-ui-big">.mw-ui-button</button>
79 // <button class="mw-ui-button mw-ui-progressive mw-ui-big">.mw-ui-progressive</button>
82 // <button class="mw-ui-button mw-ui-constructive mw-ui-big">.mw-ui-constructive</button>
85 // <button class="mw-ui-button mw-ui-destructive mw-ui-big">.mw-ui-destructive</button>
95 // Some buttons might need to be stacked.
99 // <button class="mw-ui-button mw-ui-block">.mw-ui-button</button>
102 // <button class="mw-ui-button mw-ui-progressive mw-ui-block">.mw-ui-progressive</button>
105 // <button class="mw-ui-button mw-ui-constructive mw-ui-block">.mw-ui-constructive</button>
108 // <button class="mw-ui-button mw-ui-destructive mw-ui-block">.mw-ui-destructive</button>
117 // Progressive buttons
119 // Use progressive buttons for actions which lead to a next step in the process.
120 // .mw-ui-primary is deprecated, kept for compatibility.
124 // <button class="mw-ui-button mw-ui-progressive">.mw-ui-progressive</button>
127 // <button class="mw-ui-button mw-ui-progressive" disabled>.mw-ui-progressive</button>
133 .button-colors( @colorProgressive, @colorProgressiveHighlight, @colorProgressiveActive );
136 .button-colors-quiet( @colorProgressive, @colorProgressiveHighlight, @colorProgressiveActive );
140 // Constructive buttons
142 // Use constructive buttons for actions which result in a final action in the process that results
143 // in a change of state.
144 // e.g. save changes button
148 // <button class="mw-ui-button mw-ui-constructive">.mw-ui-constructive</button>
151 // <button class="mw-ui-button mw-ui-constructive" disabled>.mw-ui-constructive</button>
155 &.mw-ui-constructive {
156 .button-colors( @colorConstructive, @colorConstructiveHighlight, @colorConstructiveActive );
159 .button-colors-quiet( @colorConstructive, @colorConstructiveHighlight, @colorConstructiveActive );
163 // Destructive buttons
165 // Use destructive buttons for actions that remove or limit, such as deleting a page or blocking a user.
166 // This should not be used for cancel buttons.
170 // <button class="mw-ui-button mw-ui-destructive">.mw-ui-destructive</button>
173 // <button class="mw-ui-button mw-ui-destructive" disabled>.mw-ui-destructive</button>
177 &.mw-ui-destructive {
178 .button-colors( @colorDestructive, @colorDestructiveHighlight, @colorDestructiveActive );
181 .button-colors-quiet( @colorDestructive, @colorDestructiveHighlight, @colorDestructiveActive );
187 // 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.
188 // Its use is not recommended on mobile/tablet due to lack of hover state.
192 // <button class="mw-ui-button mw-ui-quiet">.mw-ui-button</button>
195 // <button class="mw-ui-button mw-ui-constructive mw-ui-quiet">.mw-ui-constructive</button>
198 // <button class="mw-ui-button mw-ui-constructive mw-ui-quiet" disabled>.mw-ui-constructive</button>
201 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet">.mw-ui-destructive</button>
204 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet" disabled>.mw-ui-destructive</button>
207 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet">.mw-ui-progressive</button>
210 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet" disabled>.mw-ui-progressive</button>
215 background: transparent;
218 .button-colors-quiet( @colorButtonText, @colorButtonTextHighlight, @colorButtonTextActive );
227 background: transparent;
233 text-decoration: none;
235 // This overrides an underline declaration on a:hover and a:focus in
236 // commonElements.css, which the class alone isn't specific enough to do.
239 text-decoration: none;
242 // a-tags behave different to inputs if the line-height attribute is inherited
243 // from another element (e.g. mw-body-content). They appear bigger as input
244 // tags. See Bug T116427. To fix that, apply the correct line-height (used
245 // for inputs) to a-tags, too.
251 // Group of buttons. Make sure you clear the floating after using a mw-ui-button-group.
254 // <div class="mw-ui-button-group">
255 // <div class="mw-ui-button">A</div>
256 // <div class="mw-ui-button">B</div>
257 // <div class="mw-ui-button">C</div>
258 // <div class="mw-ui-button">D</div>
259 // </div><div style="clear:both"></div>
262 .mw-ui-button-group > * {
268 border-top-left-radius: @borderRadius;
269 border-bottom-left-radius: @borderRadius;
272 &:not( :first-child ) {
277 border-top-right-radius: @borderRadius;
278 border-bottom-right-radius: @borderRadius;