Icon

Renders icon components and SVG definitions, including icons from Lucide Icons. The system separates icon definition (stroke, classes) from usage (size, extra classes).


Basic Usage

Pass an icon component from Lucide directly to the icon prop.


Stroke Width

Use defineIcon(icon, stroke) or .setStroke() to set stroke in the definition. You can also wrap an existing definition to override its stroke or classes.


Styling with Classes

Chain .class() on a definition to attach styles. Definition classes override conflicting classes set at the usage site.


Size

Use size for abstract units (× 4 px) or pxSize for exact pixels. Size can only be set at the usage site, not inside defineIcon().


Inline SVG and URL icons

Use svgIcon(svgMarkup) for trusted inline SVG, or svgIcon(new URL('https://example.com/icon.svg')) for an image-backed icon. Strings are SVG markup, not URL strings. Inline markup is inserted as HTML without sanitization: never pass untrusted uploads or user input. Use currentColor in the SVG to inherit .class() or .color() styling.