1 @import 'mediawiki.skin.variables.less';
2 @import 'mediawiki.mixins.less';
3 @import 'mediawiki.ui/mixins.buttons.less';
5 /* stylelint-disable selector-class-pattern */
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.
13 // Neutral button styling
15 // These are the main actions on the page/workflow. The page should have only one of progressive and destructive buttons, the rest being quiet.
19 // <button class="mw-ui-button">.mw-ui-button</button>
22 // <button class="mw-ui-button" disabled>.mw-ui-button</button>
25 background-color: @background-color-interactive-subtle;
26 border-color: @border-color-base;
29 .mw-ui-button-states();
31 // If a sibling element is a checklist, the state should also apply to the button.
32 input[ type='checkbox' ]:hover + &,
34 background-color: @background-color-base;
35 color: @color-base--hover;
38 input[ type='checkbox' ]:focus + &,
40 // Make sure that `color` isn't inheriting from user-agent styles
42 border-color: @border-color-progressive--focus;
43 box-shadow: @box-shadow-inset-small @box-shadow-color-progressive--focus;
44 // Set the standard focus `outline` transparent. A `border` and `box-shadow` visual
45 // focus is added above for common rendering.
46 // In Windows high contrast mode the transparent outline becomes visible.
47 // As vendor stylesheets set the outline on `:focus`, we need to follow here too and
48 // can't rely on the next selector to override it.
49 outline: @outline-base--focus;
52 input[ type='checkbox' ]:active + &,
54 background-color: @background-color-interactive;
55 color: @color-emphasized;
56 border-color: @border-color-interactive;
60 &.mw-ui-icon-element {
61 &:not( .mw-ui-icon-with-label-desktop ) {
62 /* stylelint-disable-next-line declaration-no-important */
63 color: transparent !important;
65 span:not( .mw-ui-icon ) {
66 .mixin-screen-reader-text();
70 @media all and ( max-width: @max-width-breakpoint-tablet ) {
71 span:not( .mw-ui-icon ) {
72 .mixin-screen-reader-text();
75 &.mw-ui-icon-with-label-desktop {
76 /* stylelint-disable-next-line declaration-no-important */
77 color: transparent !important;
82 // Styling for specific button types
83 // -----------------------------------------
87 // Use quiet buttons when they are less important and alongside other progressive or destructive buttons. It should be used for an action that exits the user from the current view/workflow.
88 // Its use is not recommended on mobile/tablet due to lack of hover state.
92 // <button class="mw-ui-button mw-ui-quiet">.mw-ui-button</button>
95 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet">.mw-ui-destructive</button>
98 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet" disabled>.mw-ui-destructive</button>
101 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet">.mw-ui-progressive</button>
104 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet" disabled>.mw-ui-progressive</button>
107 &.mw-ui-quiet.mw-ui-progressive,
108 &.mw-ui-quiet.mw-ui-destructive {
109 background-color: transparent;
110 // Quiet buttons all start gray, and reveal
111 // progressive/destructive color on hover and active.
113 border-color: @border-color-transparent;
116 &:not( .mw-ui-icon-element ) {
120 // If a sibling element is a checklist, the state should also apply to the button.
121 input[ type='checkbox' ]:hover + &,
123 background-color: @background-color-button-quiet--hover;
127 input[ type='checkbox' ]:focus + &,
130 border-color: @border-color-progressive--focus;
131 box-shadow: @box-shadow-inset-small @box-shadow-color-progressive--focus;
134 input[ type='checkbox' ]:active + &,
136 background-color: @background-color-button-quiet--active;
137 color: @color-emphasized;
138 border-color: @border-color-interactive;
145 background-color: @background-color-transparent;
146 color: @color-disabled;
147 border-color: @border-color-transparent;
151 // Progressive buttons
153 // Use progressive buttons for actions which lead to a next step in the process.
157 // <button class="mw-ui-button mw-ui-progressive">.mw-ui-progressive</button>
160 // <button class="mw-ui-button mw-ui-progressive" disabled>.mw-ui-progressive</button>
162 &.mw-ui-progressive {
163 .mw-ui-button-colors-primary( @color-progressive, @color-progressive--hover, @color-progressive--active );
166 background-color: @background-color-transparent;
167 color: @color-progressive;
168 border-color: @border-color-transparent;
170 input[ type='checkbox' ]:hover + &,
172 // TODO: Should be a token.
173 // This came out of `background-color-primary` by mediawiki.ui.
174 // Value was `fade( #347bff, 20% )`, which results in `rgba( 52, 123, 255, 0.2 )`.
175 // WikimediaUI Base was featuring
176 // `@background-color-primary--hover: rgba( 41, 98, 204, 0.1 )` in contrast.
177 // Let's keep this static for the time being and revisit with a new Codex token.
178 background-color: rgba( 52, 123, 255, 0.2 );
179 color: @color-progressive--hover;
180 border-color: @border-color-transparent;
183 input[ type='checkbox' ]:focus + &,
185 color: @color-progressive--focus;
186 border-color: @color-progressive--focus;
189 input[ type='checkbox' ]:active + &,
191 color: @color-inverted;
192 background-color: @color-progressive--active;
193 border-color: @color-progressive--active;
198 // Destructive buttons
200 // Use destructive buttons for actions that remove or limit, such as deleting a page or blocking a user.
201 // This should not be used for cancel buttons.
205 // <button class="mw-ui-button mw-ui-destructive">.mw-ui-destructive</button>
208 // <button class="mw-ui-button mw-ui-destructive" disabled>.mw-ui-destructive</button>
210 &.mw-ui-destructive {
211 .mw-ui-button-colors-primary( @color-destructive, @color-destructive--hover, @color-destructive--active );
214 color: @color-destructive;
215 background-color: @background-color-transparent;
216 border-color: @border-color-transparent;
218 input[ type='checkbox' ]:hover + &,
220 background-color: @background-color-destructive--hover;
221 border-color: @border-color-transparent;
222 color: @color-destructive--hover;
225 input[ type='checkbox' ]:focus + &,
227 color: @color-destructive;
228 border-color: @color-destructive--focus;
231 input[ type='checkbox' ]:active + &,
233 color: @color-inverted;
234 background-color: @color-destructive--active;
235 border-color: @color-destructive--active;
242 // Not all buttons are equal. You can emphasise certain actions over others
243 // using the mw-ui-big class.
247 // <button class="mw-ui-button mw-ui-big">.mw-ui-button</button>
250 // <button class="mw-ui-button mw-ui-progressive mw-ui-big">.mw-ui-progressive</button>
253 // <button class="mw-ui-button mw-ui-destructive mw-ui-big">.mw-ui-destructive</button>
261 // Some buttons might need to be stacked.
265 // <button class="mw-ui-button mw-ui-block">.mw-ui-button</button>
268 // <button class="mw-ui-button mw-ui-progressive mw-ui-block">.mw-ui-progressive</button>
271 // <button class="mw-ui-button mw-ui-destructive mw-ui-block">.mw-ui-destructive</button>
282 text-decoration: none;
284 // This overrides an underline declaration on a:hover and a:focus in
285 // commonElements.css, which the class alone isn't specific enough to do.
288 text-decoration: none;
294 // Group of buttons. Make sure you clear the floating after using a mw-ui-button-group.
297 // <div class="mw-ui-button-group">
298 // <div class="mw-ui-button is-on">A</div>
299 // <div class="mw-ui-button">B</div>
300 // <div class="mw-ui-button">C</div>
301 // <div class="mw-ui-button">D</div>
302 // </div><div style="clear:both"></div>
303 .mw-ui-button-group {
310 border-top-left-radius: @border-radius-base;
311 border-bottom-left-radius: @border-radius-base;
314 &:not( :first-child ) {
319 border-top-right-radius: @border-radius-base;
320 border-bottom-right-radius: @border-radius-base;
325 cursor: @cursor-base;