Getting started
Components
Icons require a containing element for two reasons:
<span>
slds-assistive-text
title
If an icon has a visible label that describes what the icon represents, no title or hidden assistive text is required.
The containing element must have the slds-icon_container class.
slds-icon_container
An icon must have a containing element with the class slds-icon_container for accessibility support. Inside the container, a <svg> with the class slds-icon contains the reference to your icon and a <span> with the class slds-assistive-text contains your hidden assistive text that describes the icon.
<svg>
slds-icon
<div class="slds-icon_container" title="when needed"> <svg class="slds-icon" aria-hidden="true"> <use href="#icon-name"></use> </svg> <span class="slds-assistive-text
Five separate SVG sprites are used to create icons — action, custom, doctype, standard and utility. Link to the icon SVG sprite by targeting the icon hash/ID value in the use href attribute.
<div class="slds-icon_container" title="when needed"> <svg class="slds-icon" aria-hidden="true"> <use href="/assets/icons/standard-sprite/svg/symbols.svg#case"></use> </svg> <span class="slds-assistive-text">Case</span></div>
All available SVG sprites fall into one of these five main categories: action, custom, doctype, standard, and utility.
To view all available action icons, see action icons.
Custom icons have a rounded square shape and use a class on the container for the background color.
To view all available doctype icons, see doctype icons.
Standard icons have a rounded square shape and use a class on the container for the background color.
To change the fill of an icon to the default text color, add the slds-icon-text-default class to the icon.
slds-icon-text-default
To change the fill of an icon to match the current color of its parent, add the slds-current-color class to the icon container.
slds-current-color