2 * MediaWiki UI icons specification 2.0
4 * Applies the MinervaNeue icon styles, adding more mobile-friendly
5 * features like increased touch-area sizes and highlights.
7 * - mw-ui-icon = base class. 20px square with icon.
8 * - mw-ui-icon + mw-ui-icon-element = icon with padding & pseudo-states.
9 * - mw-ui-icon + mw-ui-icon-before = *deprecated*, icon with text.
10 * Labels should be placed in a separate element beside the icon.
14 @import 'mediawiki.skin.variables.less';
15 @import 'mediawiki.mixins.less';
18 @icon-touch-area-sm: 32; // This is also used for touch areas at DESKTOP resolutions.
19 @icon-touch-area-md: 44;
20 @font-size-browser: 16; // Assumed browser default of `16px`.
22 @icon-glyph-size-md: 20;
23 @icon-size-md: unit( @icon-glyph-size-md / @font-size-browser, em );
24 @icon-padding-md: unit( ( @icon-touch-area-md - @icon-glyph-size-md ) / 2 / @font-size-browser, em );
26 // Includes 2px mw-ui-button border
27 @icon-padding-md-button: unit( ( @icon-touch-area-md - @icon-glyph-size-md - 2 ) / 2 / @font-size-browser, em );
28 // At desktop resolution the icon touch area will shrink from @icon-touch-area-md to @icon-touch-area-sm
29 @icon-padding-md-button--desktop: unit( ( @icon-touch-area-sm - @icon-glyph-size-md - 2 ) / 2 / @font-size-browser, em );
32 @icon-color: @color-subtle;
33 @margin-icon-md-labelled: 6px;
36 * Mixin for a pseudo-element with a background image.
38 .mixin-background-square( @size ) {
44 // In case display: block is overridden and display gets set to `flex`
45 // because of inheritance T233521.
49 // Background properties.
50 background-repeat: no-repeat;
51 // Using static value instead of `background-size: contain` because of T233521#5545513.
52 background-size: @size @size;
53 background-position: center;
57 * A standalone 20px square with screen-reader text. Contains a :before element
58 * to house the icon as a background image. Total size is increased with padding via
59 * `box-sizing: content-box`. This separates control over size of icon vs the size of
63 // reset font-size so the "em" value is relative to the more
64 // predictable rem font size ...and no rems because we can't have nice things.
69 display: inline-block;
71 // this is important for increasing the size via padding. Overrides `.view-border-box *`.
72 /* stylelint-disable declaration-no-important */
73 box-sizing: content-box !important;
75 height: @icon-size-md;
77 // Guarding against flex-box variability.
78 min-width: @icon-size-md;
79 min-height: @icon-size-md;
80 flex-basis: @icon-size-md;
81 /* stylelint-enable declaration-no-important */
84 vertical-align: middle;
88 .text-overflow( @visible: false );
90 // resetting styles for <button> elements
91 -moz-appearance: none;
92 -webkit-appearance: none;
93 background-color: transparent;
97 &:not( .mw-ui-button ) {
102 .mixin-background-square( @icon-size-md );
105 // Use `not` selector to ensure we don't add space for machine readable markup. More info: T307233
106 & + span:not( :empty ) {
107 // Margin is added to separate accompanying text.
108 margin-left: @margin-icon-md-labelled;
112 .mw-ui-icon-element {
113 border-radius: @border-radius-base;
114 padding: @icon-padding-md;
115 // Override line-height applied by `.mw-ui-button`.
117 transition: background-color @transition-duration-base;
120 padding: @icon-padding-md-button;
122 // Combined with nowrap & ellipsis from .mw-ui-icon, forms safe "screen-reader" text.
131 // In desktop these icons shrink in size as touch area no longer important.
132 @media ( min-width: @min-width-breakpoint-desktop ) {
134 padding: @icon-padding-md-button--desktop;
145 display: inline-block;
148 min-width: @icon-size-md;
149 min-height: @icon-size-md;
151 // alignment. Margin is added to separate accompanying text.
152 margin-right: @margin-icon-md-labelled;
153 vertical-align: middle;
157 vertical-align: middle;
161 @media all and ( min-width: @min-width-breakpoint-desktop ) {
162 .mw-ui-icon-with-label-desktop {
163 // stylelint-disable-next-line declaration-no-important
164 color: @icon-color !important;
166 line-height: inherit;
168 // Special case outside of standard buttons styling due to surrounding
169 // interface elements, see T237019.
170 // stylelint-disable-next-line declaration-no-important
171 font-weight: 500 !important;
178 text-decoration: none;
183 display: inline-block;
184 // Don't use `@icon-padding-md` as we are adjacent to text.
185 margin-right: @margin-icon-md-labelled;
186 // Seems to be more visually centered than `middle`.
187 vertical-align: text-bottom;