simonhamp/statamic-heroicons
Heroicons for Statamic: a free, MIT-licensed set of SVG icons from Tailwind Labs, bundled for use in Antlers templates and the control panel. Render crisp, scalable, styleable icons via a simple tag or fieldtype without extra dependencies.
Install with composer require simonhamp/statamic-heroicons and (if prompted) publish the config: php artisan vendor:publish --tag="statamic-heroicons-config". There are no migrations or control-panel setup steps — this is a rendering addon, not a content-type addon.
Look first at config/statamic-heroicons.php (default icon style, default CSS classes) and the addon README, which is the authoritative reference for the tag syntax. The source lives under vendor/simonhamp/statamic-heroicons/src if you need to confirm how a name is resolved.
First use case: drop an icon into an existing Antlers view. In its simplest form the tag takes the icon name as the method/segment:
{{ heroicon:academic-cap }}
With an explicit style and classes:
{{ heroicon icon="academic-cap" style="solid" class="w-5 h-5 text-gray-500" }}
Confirm it renders inline <svg> in the page source before wiring it into layouts.
<img> or sprite reference), it inherits currentColor and can be styled with utility classes. Pass class="..." rather than wrapping in extra divs, and keep sizing utilities (w-4 h-4, w-5 h-5, etc.) consistent across a project by putting them in the config default.Statamic::tag('heroicon')->params([...])->fetch(), or simply define a small <x-icon> Blade component that wraps the Antlers tag. This gives you one place to enforce aria-hidden="true", default classes, and a decorative-vs-meaningful switch.{{ heroicon :icon="icon_field" }}. This is the common pattern for feature grids, navigation, and card components where editors choose an icon. Validate the stored value against the actual icon set on save if you want to avoid empty renders.class bound to a variable so list vs. detail views can size the same icon differently.{{ heroicon:... }} inside a {{ cache }} block or pre-render to a partial. For static sets of icons, consider generating a Blade partial of the SVGs once and @include-ing it.stroke-width, size, and colour utilities in the config or component rather than scattering them across templates — Heroicons v2 ships distinct outline and solid variants, so make the style explicit per context (outline for navigation chrome, solid for active/selected states).search→magnifying-glass, cog→cog-6-tooth, search-circle→magnifying-glass-circle, and several others were dropped entirely). The addon does not error on an unknown name; you typically get an empty or malformed SVG, which fails silently in production. Grep your templates and any stored field values for icon names and re-verify each one against the v2 list after upgrading.aria-hidden/data-* attributes and, in the wider set, the size classes). If you were relying on a specific default class or viewBox, diff one rendered icon before and after the upgrade.arrow-up-tray, chevron-double-left) are fine as the tag method, but mixing positional style and name can be ambiguous — prefer the explicit icon="..." and style="..." parameters in anything non-trivial to avoid surprises.aria-hidden="true" with no label; meaningful icons need an accessible name. The addon renders markup — it doesn't decide semantics. Bake this into your Blade wrapper so it isn't forgotten per-use.<svg>. Hundreds of icons on a page is a real payload cost; cache or partial-ise as above, and don't use this addon as a sprite-sheet replacement for large icon grids.focusable="false" or a consistent data-icon attribute). If you need a different icon library, the tag implementation is small enough to fork or wrap rather than fight the config.How can I help you explore Laravel packages today?