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 @transitionDuration: .1s;
16 @transitionFunction: ease-in-out;
18 // Neutral button styling
20 // 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.
24 // <button class="mw-ui-button">.mw-ui-button</button>
27 // <button class="mw-ui-button" disabled>.mw-ui-button</button>
32 // Inherit the font rather than apply user agent stylesheet (bug 70072)
36 display: inline-block;
39 .box-sizing(border-box);
41 // Disable weird iOS styling
42 -webkit-appearance: none;
45 // http://stackoverflow.com/a/5838575/365238
51 border-radius: @borderRadius;
54 // Ensure that buttons and inputs are nicely aligned when they have differing heights
55 vertical-align: middle;
61 // Interaction styling
69 .transition(background @transitionDuration @transitionFunction, color @transitionDuration @transitionFunction, box-shadow @transitionDuration @transitionFunction;);
71 // Styling for specific button types
72 // -----------------------------------------
76 // Not all buttons are equal. You can emphasise certain actions over others
77 // using the mw-ui-big class.
81 // <button class="mw-ui-button mw-ui-big">.mw-ui-button</button>
84 // <button class="mw-ui-button mw-ui-progressive mw-ui-big">.mw-ui-progressive</button>
87 // <button class="mw-ui-button mw-ui-constructive mw-ui-big">.mw-ui-constructive</button>
90 // <button class="mw-ui-button mw-ui-destructive mw-ui-big">.mw-ui-destructive</button>
100 // Some buttons might need to be stacked.
104 // <button class="mw-ui-button mw-ui-block">.mw-ui-button</button>
107 // <button class="mw-ui-button mw-ui-progressive mw-ui-block">.mw-ui-progressive</button>
110 // <button class="mw-ui-button mw-ui-constructive mw-ui-block">.mw-ui-constructive</button>
113 // <button class="mw-ui-button mw-ui-destructive mw-ui-block">.mw-ui-destructive</button>
122 // Progressive buttons
124 // Use progressive buttons for actions which lead to a next step in the process.
125 // .mw-ui-primary is deprecated, kept for compatibility.
129 // <button class="mw-ui-button mw-ui-progressive">.mw-ui-progressive</button>
132 // <button class="mw-ui-button mw-ui-progressive" disabled>.mw-ui-progressive</button>
138 .button-colors(@colorProgressive);
141 .button-colors-quiet(@colorProgressive);
145 // Constructive buttons
147 // Use constructive buttons for actions which result in a final action in the process that results
148 // in a change of state.
149 // e.g. save changes button
153 // <button class="mw-ui-button mw-ui-constructive">.mw-ui-constructive</button>
156 // <button class="mw-ui-button mw-ui-constructive" disabled>.mw-ui-constructive</button>
160 &.mw-ui-constructive {
161 .button-colors(@colorConstructive);
164 .button-colors-quiet(@colorConstructive);
168 // Destructive buttons
170 // Use destructive buttons for actions that remove or limit, such as deleting a page or blocking a user.
171 // This should not be used for cancel buttons.
175 // <button class="mw-ui-button mw-ui-destructive">.mw-ui-destructive</button>
178 // <button class="mw-ui-button mw-ui-destructive" disabled>.mw-ui-destructive</button>
182 &.mw-ui-destructive {
183 .button-colors(@colorDestructive);
186 .button-colors-quiet(@colorDestructive);
192 // 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.
193 // Its use is not recommended on mobile/tablet due to lack of hover state.
197 // <button class="mw-ui-button mw-ui-quiet">.mw-ui-button</button>
200 // <button class="mw-ui-button mw-ui-constructive mw-ui-quiet">.mw-ui-constructive</button>
203 // <button class="mw-ui-button mw-ui-constructive mw-ui-quiet" disabled>.mw-ui-constructive</button>
206 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet">.mw-ui-destructive</button>
209 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet" disabled>.mw-ui-destructive</button>
212 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet">.mw-ui-progressive</button>
215 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet" disabled>.mw-ui-progressive</button>
220 background: transparent;
223 .button-colors-quiet(@colorButtonText);
232 background: transparent;
238 text-decoration: none;
240 // This overrides an underline declaration on a:hover and a:focus in
241 // commonElements.css, which the class alone isn't specific enough to do.
244 text-decoration: none;
250 // Group of buttons. Make sure you clear the floating after using a mw-ui-button-group.
253 // <div class="mw-ui-button-group">
254 // <div class="mw-ui-button">A</div>
255 // <div class="mw-ui-button">B</div>
256 // <div class="mw-ui-button">C</div>
257 // <div class="mw-ui-button">D</div>
258 // </div><div style="clear:both"></div>
261 .mw-ui-button-group > * {
267 border-top-left-radius: @borderRadius;
268 border-bottom-left-radius: @borderRadius;
271 &:not(:first-child) {
276 border-top-right-radius: @borderRadius;
277 border-bottom-right-radius: @borderRadius;