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>
28 display: inline-block;
31 .box-sizing(border-box);
33 // Disable weird iOS styling
34 -webkit-appearance: none;
37 // http://stackoverflow.com/a/5838575/365238
43 border-radius: @buttonBorderRadius;
45 // Ensure that buttons and inputs are nicely aligned when they have differing heights
46 vertical-align: middle;
52 // Interaction styling
60 .transition(background @transitionDuration @transitionFunction, color @transitionDuration @transitionFunction, box-shadow @transitionDuration @transitionFunction;);
62 // Styling for specific button types
63 // -----------------------------------------
67 // Not all buttons are equal. You can emphasise certain actions over others
68 // using the mw-ui-big class.
71 // <button class="mw-ui-button mw-ui-big">.mw-ui-button</button>
72 // <button class="mw-ui-button mw-ui-progressive mw-ui-big">.mw-ui-progressive</button>
73 // <button class="mw-ui-button mw-ui-constructive mw-ui-big">.mw-ui-constructive</button>
74 // <button class="mw-ui-button mw-ui-destructive mw-ui-big">.mw-ui-destructive</button>
83 // Some buttons might need to be stacked.
86 // <button class="mw-ui-button mw-ui-block">.mw-ui-button</button>
87 // <button class="mw-ui-button mw-ui-progressive mw-ui-block">.mw-ui-progressive</button>
88 // <button class="mw-ui-button mw-ui-constructive mw-ui-block">.mw-ui-constructive</button>
89 // <button class="mw-ui-button mw-ui-destructive mw-ui-block">.mw-ui-destructive</button>
97 // Progressive buttons
99 // Use progressive buttons for actions which lead to a next step in the process.
100 // .mw-ui-primary is deprecated, kept for compatibility.
103 // <button class="mw-ui-button mw-ui-progressive">.mw-ui-progressive</button>
104 // <button class="mw-ui-button mw-ui-progressive" disabled>.mw-ui-progressive</button>
109 .button-colors(@colorProgressive);
112 .button-colors-quiet(@colorProgressive);
116 // Constructive buttons
118 // Use constructive buttons for actions which result in a final action in the process that results
119 // in a change of state.
120 // e.g. save changes button
123 // <button class="mw-ui-button mw-ui-constructive">.mw-ui-constructive</button>
124 // <button class="mw-ui-button mw-ui-constructive" disabled>.mw-ui-constructive</button>
127 &.mw-ui-constructive {
128 .button-colors(@colorConstructive);
131 .button-colors-quiet(@colorConstructive);
135 // Destructive buttons
137 // Use destructive buttons for actions which result in the destruction of data.
138 // e.g. deleting a page.
139 // This should not be used for cancel buttons.
142 // <button class="mw-ui-button mw-ui-destructive">.mw-ui-destructive</button>
143 // <button class="mw-ui-button mw-ui-destructive" disabled>.mw-ui-destructive</button>
146 &.mw-ui-destructive {
147 .button-colors(@colorDestructive);
150 .button-colors-quiet(@colorDestructive);
156 // Use quiet buttons when they are less important and alongisde other progressive/destructive/progressive buttons.
159 // <button class="mw-ui-button mw-ui-quiet">.mw-ui-button</button>
160 // <button class="mw-ui-button mw-ui-constructive mw-ui-quiet">.mw-ui-constructive</button>
161 // <button class="mw-ui-button mw-ui-constructive mw-ui-quiet" disabled>.mw-ui-constructive</button>
162 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet">.mw-ui-destructive</button>
163 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet" disabled>.mw-ui-destructive</button>
164 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet">.mw-ui-progressive</button>
165 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet" disabled>.mw-ui-progressive</button>
169 background: transparent;
172 .button-colors-quiet(@colorButtonText);
181 background: transparent;
187 text-decoration: none;
189 // This overrides an underline declaration on a:hover and a:focus in
190 // commonElements.css, which the class alone isn't specific enough to do.
193 text-decoration: none;
199 // Group of buttons. Make sure you clear the floating after using a mw-ui-button-group.
202 // <div class="mw-ui-button-group">
203 // <div class="mw-ui-button">A</div>
204 // <div class="mw-ui-button">B</div>
205 // <div class="mw-ui-button">C</div>
206 // <div class="mw-ui-button">D</div>
207 // </div><div style="clear:both"></div>
210 .mw-ui-button-group > * {
215 border-top-left-radius: @buttonBorderRadius;
216 border-bottom-left-radius: @buttonBorderRadius;
219 &:not(:first-child) {
224 border-top-right-radius: @buttonBorderRadius;
225 border-bottom-right-radius: @buttonBorderRadius;