All guides and resources

Use SVG icons in a web interface

Place a decorative icon, enable monochrome theming, and give icon buttons accessible names.

Browse the icon libraryTry the UI examples

Start from a free icon

Open Playday Search, choose Color, and download its SVG. Save it as search.svg in your site’s icons folder. Use an image element to keep the artwork’s original colors. Set width and height to reserve space in the layout. Give decorative icons an empty alt attribute when nearby text already explains them.

<button type="button">
  <img src="/icons/search.svg" width="24" height="24" alt="">
  Search
</button>

Let monochrome follow the button color

Copy the monochrome SVG into the markup. Remove the hard-coded color attribute on the root SVG so its currentColor paint inherits from the button. Add aria-hidden="true" to the SVG and give any icon-only button an accessible name, such as aria-label="Open search".

Check the finished control

Tab to the button and verify its focus indicator. Check the background in both light and dark mode. Keep the target larger than the artwork itself so it remains comfortable to press on a phone.