Icons
Covers: SVG icons, Heroicons, inline checkmarks, icon buttons, icon sizing, icon alignment with text.
Design Rules
- Never generate raw SVG icons: import from the project's icon library, or Heroicons if none is established.
- Never wrap icons in decorative containers (colored squares, circles with backgrounds): use the icon directly.
- Never scale icons:
viewBox="0 0 24 24"usessize-6,viewBox="0 0 20 20"usessize-5,viewBox="0 0 16 16"usessize-4. If an icon looks too small, switch icon sets, don't bump the size class. - Use 16px/micro icons (
size-4) inline withtext-smtext (checklists, feature items, comparison tables, inline labels); use 20px/mini (size-5) only for navigation list icons. - Aligning an icon next to a text group (label + supporting text): align it to the first line/label with
items-startoritems-baseline, neveritems-centeron the group. - Application UIs (dashboards, settings, admin, sidebar nav, forms): use only Heroicons Micro (16px,
size-4); never 20px/mini or 24px/outline. - Icons paired with text should usually be visually quieter than the label: lower opacity, use the secondary text color, or reduce emphasis so the icon supports recognition without becoming the focal point.
- With a stroke-based icon set (Lucide, Tabler), match stroke to the adjacent text weight:
1.5pxbeside regular (400) text,2pxbeside medium/semibold (500-600),2.5pxbeside bold (700). A hairline icon beside a bold label reads as broken. One stroke weight per surface; never mix icon libraries on one toolbar. - Optically center asymmetric icons in icon-only buttons. If geometry looks off, adjust the SVG viewBox or wrapper alignment rather than trusting mathematical centering.
Coding Rules
- Use
size-{n} h-lhon SVG icons to vertically center them with adjacent text; setfont-sizeon a wrapper instead of top margins or manual alignment. - Use
fill-{color}for filled icons andstroke-{color}for stroked icons; nevertext-{color}withcurrentColor(legacy v2 hack). - Always add
shrink-0to icons inside flex containers.