Astro
pulsoicon-astro — animated Astro icons, rendered on the server with no framework island, with the same props as every PulsoIcon package.
Try every example live on the Astro demo page.
Installation
npm install pulsoicon-astro
Astro 5 or newer. Motion 12 or newer plays the icons and is installed with the package. No integration to add: the icons are plain Astro components.
Quick start
---
import { Bell, Calendar, Trash2 } from "pulsoicon-astro";
---
<button><Bell size={20} /> Notifications</button>
<button><Calendar /> Schedule</button>
<button><Trash2 color="crimson" strokeWidth={1.5} /> Delete</button>
Each icon is rendered to SVG on the server. A small script per icon type hands its motion to the browser, so only the icons on the page ship their motion. Icons keep working after view transitions.
Props
size (24), color (currentColor), strokeWidth (2), absoluteStrokeWidth (false), solid (false), animated (true) and autoAnimated (true), as in React. Any other attribute (class, style, id, aria-label) goes on the <svg>. There is no play prop: the component renders once on the server, so play it from a script (below).
Outline, solid and static
<Heart />
<Heart solid />
<Heart animated={false} />
<Heart solid animated={false} />
Play from code
getIconHandle(svg) from pulsoicon-astro/client gives the icon’s startAnimation() and stopAnimation(); both return a promise that resolves when the motion has finished.
---
import { Check } from "pulsoicon-astro";
---
<button id="save"><Check autoAnimated={false} /> Save</button>
<script>
import { getIconHandle } from "pulsoicon-astro/client";
const button = document.querySelector("#save")!;
button.addEventListener("click", () => getIconHandle(button.querySelector("svg")!)?.startAnimation());
</script>
In framework islands
Inside a React, Vue, Svelte, Solid or Preact island, use that framework’s package (pulsoicon-react, pulsoicon-vue, …) instead: they draw the same icons with the same motion.
Loading icons by name
pulsoicon-astro/all exports every icon by kebab-case name (all of them). pulsoicon-astro/names lists the names without loading any icon, and pulsoicon-astro/icons/<name> is one icon’s component.
Accessibility
Icons render with aria-hidden="true"; label the button or link they sit in. Nothing moves when the system asks for reduced motion.