2.11.0
Icons enhance experiences by visually communicating meaning, actions, status, and feedback. Browse available icons on the Iconography page.
Use to create a static, non-interactive icon.
<svg class="mds-icon">
<use xlink:href="/icons/mds.svg#heart">
<title>favorite</title>
</use>
</svg>
<mds-icon name="heart" title="favorite"></mds-icon>
Icons are available in small and medium sizes. The default size is medium, and you can use modifier classes or props to make them smaller or larger.
<svg class="mds-icon mds-icon--s">
<use xlink:href="/icons/mds.svg#heart--s">
<title>favorite</title>
</use>
</svg>
<mds-icon name="heart--s" title="favorite"></mds-icon>
23px
by 23px
.15px
by 15px
.#000000
by default, style icons by adding a fill
property in your product’s CSS.
Class
|
Applies to
|
Outcome
|
---|---|---|
|
|
Scales icon down to |
@include icon-height-removal()
Use to vertically center an icon without influencing overall vertical spacing, particularly when cropping text to cap height and baseline using the mds-text-crop
mixin.
Prop
|
Type
|
Validation
|
Default
|
Description
|
---|---|---|---|---|
|
Boolean |
— |
|
Sets the |
|
String |
— |
— |
A space-separated list of class names that will be appended to the default |
|
String |
— |
— |
The |
|
String |
Required |
— |
A string containing a valid MDS icon name. |
|
String |
— |
— |
Describes the icon for assistive technologies. Used only when there is no accompanying text with the icon, e.g., a Button with icon. |
hiddenLabel
would be written as hidden-label
.The MDS icon sprite, mds.svg
must be injected into any page where the <mds-icon>
web component is used. Previous implementations of icons in MDS allowed loading of the icon sprite via an external reference, but that method has proved unreliable when used alongside custom elements.
Selecting an icon:
<mds-icon name="heart"></mds-icon>
Using the title attribute:
<mds-icon name="question-circle--s" title="FAQ"></mds-icon>
<title>
tag within the SVG with a text describing the icons.