Contents
Is the lightning icon available in Lightning out?
Icons are not available in Lightning Out, but they are available in Lightning Components for Visualforce and other experiences. For IE11, the custom icon feature is disabled for now due to performance issues. lightning-icon is available in the Base Components Recipes GitHub repository.
How to link to a lightning experience page?
To link to Lightning Experience pages, use lightning:formattedUrl in your custom component. The lightning:formattedUrl component displays a URL as a hyperlink. If you use raw anchor tags or the ui:outputUrl (deprecated) component for links, the page does a full reload each time you click the link.
What do lightning icons do in Salesforce Lightning?
A lightning-icon is a visual element that provides context and enhances usability. Icons can be used inside the body of another component or on their own. You can specify an icon from the Lightning Design System using the icon-name attribute. Here is an example. Alternatively, you can provide a custom icon using the src attribute.
How to import SVG into a lightning component?
Import the SVG resource into your component, and set a variable to the static resource URL plus the ID. Pass the static resource variable in the src attribute. For more information about static resources and using SVG, see Access Static Resources and Use SVG Resources in the Lightning Web Components Developer Guide.
Why is the lightning icon not working in CSS?
You can’t affect the inner parts of a component because of CSS isolation. You can alter the background, border, etc of the lightning-icon, but you can’t affect the arrow within aside from any supported variants. See this example: To change the color of your utility icon, if found the following to work.
How to create an icon in Salesforce Lightning?
Define a static resource in your org and upload your icon’s SVG resource to it. The SVG code must include a element with an id that you can reference. For example, suppose your static resource is named mySVG_icon and it contains this google.svg content.
The size of the buttonIcon. For the bare variant, options include x-small, small, medium, and large. For non-bare variants, options include xx-small, x-small, small, and medium. This value defaults to medium. Specifies the tab order of an element when the Tab key is used for navigating.
Can a variant be used on a utility icon?
Variants are supported only for the utility icons. To change the appearance of a utility icon, use the variant attribute with one of these values. This example uses the error variant to add a red fill to the error utility icon. To apply additional styling, use the SLDS utility classes with the class attribute.