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 @buttonBorderRadius: 3px;
16 @transitionDuration: .1s;
17 @transitionFunction: ease-in-out;
19 // Neutral button styling
22 // <button class="mw-ui-button">.mw-ui-button</button>
23 // <button class="mw-ui-button" disabled>.mw-ui-button</button>
29 display: inline-block;
32 .box-sizing(border-box);
34 // Disable weird iOS styling
35 -webkit-appearance: none;
38 // http://stackoverflow.com/a/5838575/365238
44 border-radius: @buttonBorderRadius;
46 // Ensure that buttons and inputs are nicely aligned when they have differing heights
47 vertical-align: middle;
53 // Interaction styling
61 .transition(background @transitionDuration @transitionFunction, color @transitionDuration @transitionFunction, box-shadow @transitionDuration @transitionFunction;);
63 // Styling for specific button types
64 // -----------------------------------------
68 // Not all buttons are equal. You can emphasise certain actions over others
69 // using the mw-ui-big class.
72 // <button class="mw-ui-button mw-ui-big">.mw-ui-button</button>
73 // <button class="mw-ui-button mw-ui-progressive mw-ui-big">.mw-ui-progressive</button>
74 // <button class="mw-ui-button mw-ui-constructive mw-ui-big">.mw-ui-constructive</button>
75 // <button class="mw-ui-button mw-ui-destructive mw-ui-big">.mw-ui-destructive</button>
84 // Some buttons might need to be stacked.
87 // <button class="mw-ui-button mw-ui-block">.mw-ui-button</button>
88 // <button class="mw-ui-button mw-ui-progressive mw-ui-block">.mw-ui-progressive</button>
89 // <button class="mw-ui-button mw-ui-constructive mw-ui-block">.mw-ui-constructive</button>
90 // <button class="mw-ui-button mw-ui-destructive mw-ui-block">.mw-ui-destructive</button>
98 // Progressive buttons
100 // Use progressive buttons for actions which lead to a next step in the process.
101 // .mw-ui-primary is deprecated, kept for compatibility.
104 // <button class="mw-ui-button mw-ui-progressive">.mw-ui-progressive</button>
105 // <button class="mw-ui-button mw-ui-progressive" disabled>.mw-ui-progressive</button>
110 .button-colors(@colorProgressive);
113 .button-colors-quiet(@colorProgressive);
117 // Constructive buttons
119 // Use constructive buttons for actions which result in a final action in the process that results
120 // in a change of state.
121 // e.g. save changes button
124 // <button class="mw-ui-button mw-ui-constructive">.mw-ui-constructive</button>
125 // <button class="mw-ui-button mw-ui-constructive" disabled>.mw-ui-constructive</button>
128 &.mw-ui-constructive {
129 .button-colors(@colorConstructive);
132 .button-colors-quiet(@colorConstructive);
136 // Destructive buttons
138 // Use destructive buttons for actions which result in the destruction of data.
139 // e.g. deleting a page.
140 // This should not be used for cancel buttons.
143 // <button class="mw-ui-button mw-ui-destructive">.mw-ui-destructive</button>
144 // <button class="mw-ui-button mw-ui-destructive" disabled>.mw-ui-destructive</button>
147 &.mw-ui-destructive {
148 .button-colors(@colorDestructive);
151 .button-colors-quiet(@colorDestructive);
157 // Use quiet buttons when they are less important and alongisde other progressive/destructive/progressive buttons.
160 // <button class="mw-ui-button mw-ui-quiet">.mw-ui-button</button>
161 // <button class="mw-ui-button mw-ui-constructive mw-ui-quiet">.mw-ui-constructive</button>
162 // <button class="mw-ui-button mw-ui-constructive mw-ui-quiet" disabled>.mw-ui-constructive</button>
163 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet">.mw-ui-destructive</button>
164 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet" disabled>.mw-ui-destructive</button>
165 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet">.mw-ui-progressive</button>
166 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet" disabled>.mw-ui-progressive</button>
170 background: transparent;
173 .button-colors-quiet(@colorButtonText);
182 background: transparent;
188 text-decoration: none;
190 // This overrides an underline declaration on a:hover and a:focus in
191 // commonElements.css, which the class alone isn't specific enough to do.
194 text-decoration: none;
200 // Group of buttons. Make sure you clear the floating after using a mw-ui-button-group.
203 // <div class="mw-ui-button-group">
204 // <div class="mw-ui-button">A</div>
205 // <div class="mw-ui-button">B</div>
206 // <div class="mw-ui-button">C</div>
207 // <div class="mw-ui-button">D</div>
208 // </div><div style="clear:both"></div>
211 .mw-ui-button-group > * {
216 border-top-left-radius: @buttonBorderRadius;
217 border-bottom-left-radius: @buttonBorderRadius;
220 &:not(:first-child) {
225 border-top-right-radius: @buttonBorderRadius;
226 border-bottom-right-radius: @buttonBorderRadius;