@stnd/icon
Circle 2 — Application Superpower (Official Extension) · Stable · First-Party
Role: SVG icon component (
<Icon>) with build-time copying (130+ icons) and Lottie vector animation support.When to use: Render inline or cached SVG icons sized to cap-height (
1cap) or optical tokens.
Quick Start (TL;DR)
---
import Icon from "@stnd/icon/Icon.astro";
---
<Icon icon="ph:magnifying-glass" width="1cap" height="1cap" />
Unified icon system for the Standard Ecosystem.
ELI5
One <Icon icon="…" /> component with two execution modes depending on the target environment:
| Component / Mode | Resolution Timing | Source | Client JS |
|---|---|---|---|
Icon.astro (default inline mode) |
Build time (SSR) | Local packages/icon/icons/ library, falling back to api.iconify.design |
Zero |
Icon.svelte (and Icon.astro file mode) |
Runtime | Static /icons/<prefix>/<name>.svg copied from the local library at build time |
Minimal |
"N missing from local library"Static /icons/... files are populated only from packages/icon/icons/. Icons not present locally still render normally in Icon.astro (inline mode fetches them at build time), but will 404 if requested at runtime via Icon.svelte.
Use it:
---
import Icon from "@stnd/icon/Icon.astro";
---
<Icon icon="ph:house" />
<Icon icon="home" /> <!-- alias, see tokens.js -->
Overview
@stnd/icon provides a consistent API for using icons across different frameworks (Astro and Svelte) and libraries (Phosphor, MingCute). It supports static SVG inlining, local file serving, and animated Lottie icons.
Key Components
Icon.astro: Build-time SSR icon component. Inlines SVGs for zero client-side JS.Icon.svelte: Runtime icon component. Serves SVGs as static files.Lottie.astro/Lottie.svelte: Components for rendering animated Lottie icons.
Features
- Multi-Library: Native support for Phosphor (
ph:) and MingCute (mingcute:). - Short Tokens: Use aliases like
searchinstead ofph:magnifying-glass. - Zero Config: Icons are bundled and resolved automatically.
- Resolution Order (
resolve.server.js):- Local SVG file (
packages/icon/icons/<prefix>/<name>.svg). - Live fetch from
api.iconify.design(no installed-package step exists —
the resolver goes straight from local file to network).
- Local SVG file (
Cheatsheet
Usage
In Astro
---
import Icon from "@stnd/icon/Icon.astro";
---
<Icon icon="ph:house" />
<Icon icon="search" /> <!-- alias -->
In Svelte
<script>
import Icon from "@stnd/icon/Icon.svelte";
</script>
<Icon icon="ph:rocket" width="2em" />
Tokens
Commonly used icons have short aliases defined in tokens.js. You can extend this mapping in your module configuration.
search→ph:magnifying-glasssettings→ph:slidershome→ph:houseplant→ph:plant