1 @import "mediawiki.mixins";
2 @import "mediawiki.ui/variables";
3 @import "mediawiki.ui/mixins";
10 - .mw-ui-button can **only** be used on **A, INPUT, and BUTTON tags**. There is support for some input types, but this doesn't work in older browsers.
11 - .mw-ui-progressive, .mw-ui-constructive, and .mw-ui-destructive can be applied alone on A (see Styleguide 4.0), but can be applied in tandem with .mw-ui-button. *The class order is important:* **base type** (mw-ui-button) must come **first**, **mode** (mw-ui-quiet) **second**, and **context** (mw-ui-progressive) comes **last**.
12 - A .mw-ui-quiet button may **never** be the first or only button in a form.
13 - Semantically, the **first button in a form should always be the affirmative action** (eg. Submit). This is for accessibility purposes. Where it appears visually is not as important.
17 - IE6 does not apply any .mw-ui-button styles at all on BUTTON.
18 - IE6 only applies the base .mw-ui-CONTEXT color on A, and doesn't care if you are combining it (ie. .mw-ui-destructive.mw-ui-quiet = always red text).
19 - IE7 and IE8 look slightly different from other browsers when rendering certain modes of these buttons.
22 <button class="mw-ui-button {$modifiers}">Default</button>
23 <button class="mw-ui-button mw-ui-progressive {$modifiers}">Progressive</button>
24 <button class="mw-ui-button mw-ui-constructive {$modifiers}">Constructive</button>
25 <button class="mw-ui-button mw-ui-destructive {$modifiers}">Destructive</button>
26 <button class="mw-ui-button mw-ui-progressive {$modifiers}" disabled>Disabled Progressive</button>
28 .mw-ui-quiet - Quiet: A button that doesn't look like a button.
29 .mw-ui-inline - Inline: An even smaller button (zero padding) which also inherits font weight.
30 .mw-ui-big - Big: 1.3x font-size.
36 // Individual Button Contexts
37 .mixin-mw-ui-button-context( @contextualColor ) {
38 @textShadowColor: spin( @colorTextLight, 180 );
39 @borderColor: mix( @contextualColor, #000, 75% );
40 @raisedColor: mix( @contextualColor, #fff, 92% );
41 @depressedColor: darken( @contextualColor, 8% );
42 @quietDepressedColor: darken( @contextualColor, 25% );
44 .mixin-mw-ui-button-disabled-state() {
48 background: @colorGrayLight;
51 .box-shadow( ~"none" );
55 .mixin-mw-ui-button-normal-mode() {
56 background: @contextualColor;
58 text-shadow: 0 1px fade( @textShadowColor, 10% );
60 .mixin-mw-ui-button-disabled-state();
64 background: @raisedColor;
65 text-shadow: 0 1px fade( @textShadowColor, 33% );
69 // Shadow under outer, 3D raising inner, edge shading inner
70 .box-shadow( ~"0 1px 0 0 rgba(0, 0, 0, .15), inset 0 -4px 0 0 @{borderColor}, inset 0 -1px 1px 0 rgba(0, 0, 0, .05)" );
74 // 3D raising inner, edge shading inner
75 .box-shadow( ~"inset 0 -4px 0 0 @{borderColor}, inset 0 -1px 1px 0 rgba(0, 0, 0, .05), inset 0 0 0 1px @{borderColor}" );
79 background: @depressedColor;
80 // Slight 3D raising inner, deep edge shading inner
81 .box-shadow( ~"inset 0 -2px 0 0 @{depressedColor}, inset 0 2px 0 0 rgba(0, 0, 0, .25)" );
85 // Default mode (fully colored)
87 .mixin-mw-ui-button-normal-mode();
89 .lte-ie8 & { // IE7 & IE8 do not support :not() selector
90 .mixin-mw-ui-button-normal-mode();
93 // Quiet mode (transparent bg, no border; text color on activity)
94 .lte-ie8 &.mw-ui-quiet,
96 background: transparent;
97 color: @colorTextLight;
100 color: @contextualColor;
104 color: @depressedColor;
108 color: @quietDepressedColor;
111 .mixin-mw-ui-button-disabled-state();
115 // Default button styles
116 .mixin-mw-ui-button-default() {
117 background: @colorGrayLightest;
118 color: @colorTextLight;
119 @textShadowColor: spin( @colorTextLight, 180 );
120 @borderColor: mix( @colorGrayLightest, #000, 75% );
121 @raisedColor: mix( @colorGrayLightest, #fff, 92% );
122 @depressedColor: darken( @colorGrayLightest, 8% );
123 @quietDepressedColor: darken( @colorGrayLightest, 25% );
125 .mixin-mw-ui-button-normal-mode() {
128 background: @raisedColor;
129 text-shadow: 0 1px fade( @textShadowColor, 33% );
133 // Shadow under outer, 3D raising inner, edge shading inner
134 .box-shadow( ~"0 1px 0 0 rgba(0, 0, 0, .15), inset 0 -4px 0 0 @{borderColor}, inset 0 -1px 1px 0 rgba(0, 0, 0, .05)" );
138 // 3D raising inner, edge shading inner
139 .box-shadow( ~"inset 0 -4px 0 0 @{borderColor}, inset 0 -1px 1px 0 rgba(0, 0, 0, .05), inset 0 0 0 1px @{borderColor}" );
143 background: @depressedColor;
144 // Slight 3D raising inner, deep edge shading inner
145 .box-shadow( ~"inset 0 -2px 0 0 @{depressedColor}, inset 0 2px 0 0 rgba(0, 0, 0, .25)" );
149 // Default mode (fully colored)
150 &:not(.mw-ui-quiet) {
151 .mixin-mw-ui-button-normal-mode();
153 .lte-ie8 & { // IE7 & IE8 do not support :not() selector
154 .mixin-mw-ui-button-normal-mode();
157 // Quiet mode (transparent bg, no border; text color on activity)
158 .lte-ie8 &.mw-ui-quiet,
160 background: transparent;
170 // Selector mixins, used for customization if needed
171 .mixin-mw-ui-button() {
173 display: inline-block;
176 vertical-align: middle;
177 .box-sizing(border-box);
183 // Disable weird iOS styling
184 -webkit-appearance: none;
187 font-family: inherit;
190 line-height: inherit;
191 text-decoration: none;
194 border: 0px solid transparent;
199 .transition( ~"box-shadow .1s linear, background-color .1s linear, opacity .5s linear" );
201 // Disabled state (cursor fix)
205 // Focus/active state (outline fix)
211 * Button modes (continued in .mw-ui-button-context())
214 // Thin mode (no padding)
217 font-weight: inherit;
218 vertical-align: inherit;
221 // Big mode (1.3x font size)
227 * Default button styles
230 .mixin-mw-ui-button-default();
236 // Progressive context
237 &.mw-ui-progressive {
238 .mixin-mw-ui-button-context( @colorProgressive );
241 // Constructive context
242 &.mw-ui-constructive {
243 .mixin-mw-ui-button-context( @colorConstructive );
246 // Destructive context
247 &.mw-ui-destructive {
248 .mixin-mw-ui-button-context( @colorDestructive );
256 // Default mw-ui-button implementation forces min dimensions for improved touch access
260 // When these buttons are children of mw-ui-button-group, adjust accordingly
261 .mw-ui-button-group > & {
262 .mw-ui-button-group-child;
272 <div class="mw-ui-button-group">
273 <a class="mw-ui-button" href=javascript:void(0)>A</a>
274 <a class="mw-ui-button" href=javascript:void(0)>B</a>
275 <a class="mw-ui-button" href=javascript:void(0)>C</a>
276 <a class="mw-ui-button" href=javascript:void(0)>D</a>
281 .mw-ui-button-group {
291 // To be used within .mw-ui-button selector
292 .mw-ui-button-group-child() {
297 border-top-left-radius: 3px;
298 border-bottom-left-radius: 3px;
302 border-top-right-radius: 3px;
303 border-bottom-right-radius: 3px;