Icon Sprite
Renders the Lucide icon sprite as hidden <symbol>
definitions. Include it once per page, wherever global.css is imported
(typically the site’s root layout); every Icon on the page then resolves
against it.
Options
Section titled “Options”None: it takes no props.
---import IconSprite from '@samla/ui/IconSprite.astro';import '@samla/ui/global.css';import Usage from "../../../components/Usage.astro";---
<IconSprite />No preview here: this component renders nothing visible by design. See
Icon for a live example, which only renders correctly
because this docs site includes IconSprite once, site-wide.
Adding another icon
Section titled “Adding another icon”The sprite ships a curated subset of Lucide, not the whole set. To add one:
npm install lucide-static(anywhere; it’s only used as a source of SVG files, not a runtime dependency of this library).- Find the icon at
node_modules/lucide-static/icons/<name>.svg. Names are kebab-case and match lucide.dev/icons. - Copy its
<path>/<circle>/etc. children into a new<symbol id="lucide-<name>" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">block insrc/elements/IconSprite.astro, keeping those five attributes (every Lucide icon shares them). - Use it as
<Icon name="<name>" />.