How to use SLDS icons in LWC?

586    Asked by AlGerman in Salesforce , Asked on Sep 23, 2022

I have slds-nav-vertical which will iterate the list with the icon. I'm using slds-icon_container But icon is not coming. It looks like Below.



On clicking the above link getting following error Uncaught TypeError: Cannot read property 'menuItemId' of undefined throws at


  


Answered by Alison Kelly

Use lightning-icon component, it's prebuilt in LWC framework.



All SLDS icons are supported out of the box in this component.

Refer to detailed documentation.

You can also get the icon on the button by just specifying the name of the icon.




Your Answer

Interviews

Parent Categories