Icons are a great way to add visual elements to your page. They can be used to represent actions, objects, or even just to add some flair to your design.

Heroicons are a set of free, MIT-licensed high-quality SVG icons for you to use in your web projects. You can find them at https://heroicons.com.

Basic Icons

By default, icons are displayed with the size-5 Tailwind class to set the width and height. This can be overridden without using the ! Tailwind modifier because we utilize the :where() pseudo-class to ensure that our default classes have the lowest CSS specificity possible.

The icon color will inherit the text color of the parent element.

Additionally, if it's more convenient for your purposes, you can pass the icon as a keyword argument using the icon: option instead of the first positional argument.

Preview
Code
= hero_icon("academic-cap")
= hero_icon(icon: "adjustments-horizontal")
%span.text-blue-500
  = hero_icon("archive-box")

Customized Icons

You can customize the size, color, and other properties of the icons using standard Tailwind classes.

Preview
Code
= hero_icon("no-symbol", css: "size-4 text-red-600")
= hero_icon("arrow-trending-up", css: "size-10 text-green-600")
= hero_icon("exclamation-triangle", css: "size-14 text-yellow-400 animate-pulse")
Made with by Profoundry .
Copyright © 2023-2025 Profoundry LLC.
All rights reserved.