Icons
Inline SVG icons from Iconify collections, injected at build time. Source files stay clean (one Handlebars call), compiled HTML contains pure SVG ready for copy-paste into WordPress.
{{icon "set:name"}}
Helper defined in vite-helpers/icon.js and registered in both Vite configs. Each icon set's JSON is loaded once per build and cached in memory.
Browse all 200+ available collections at icon-sets.iconify.design.
Quick Start
First positional argument is "set:name". Any hash argument is forwarded as an attribute on the root <svg>.
Default
1em × 1em
With class
Custom size
Collections
Each collection is installed as an npm package. Use its prefix in the icon id.
Installed
lucide Lucide — modern outline icons, currentColor + uniform stroke ~1700
bi Bootstrap Icons — matches Bootstrap aesthetic ~2000
Attributes
Any hash argument is forwarded onto the root <svg>. User values override defaults.
Common attributes
class — CSS classes (Bootstrap utilities, custom, etc.)
width 1em Pixel value or any CSS length
height 1em Pixel value or any CSS length
style — Inline style declaration
role — Accessibility role (e.g. img)
aria-label — Accessible name when the icon conveys meaning
aria-hidden — Set to true for purely decorative icons
Sizing & Coloring
Icons inherit text size via 1em defaults and text color via currentColor.
Scales with font-size
Small text
Medium text
Large text
Display text
Inherits color
Common Patterns
Recipes for typical UI uses.
Button with icon
Icon-only button
aria-label required
Inline list bullets
- Inline SVG, no font loading
- Inherits currentColor and font-size
- Works in WordPress copy-paste workflow
Caveats
Things to know before going to production.
Stroke width
Lucide bakes stroke-width into inner SVG groups, so passing stroke-width on the outer <svg> may have no visual effect. To customize, target inner elements via CSS:
Missing icons
If an icon or collection is missing, the helper renders a dashed-outline placeholder with an aria-label describing the issue, plus a console warning during build. This keeps errors visible without breaking the build.
Output size
Every {{icon}} call inlines the full SVG body in the compiled HTML. For pages with many repeated icons, expect the HTML to grow accordingly. This is the intended trade-off — no font/sprite to load, and the HTML is portable (WordPress paste).