PulsoIcon

Astro 5+ · pulsoicon-astro

PulsoIcon for Astro

Every icon on this page is a pulsoicon-astro component, rendered to HTML at build time with no framework island. Only the icons on the page ship their motion, and they draw the same SVG and move the same way as the React package.

Install

npm install pulsoicon-astro

Astro 5 or newer. Motion (12 or newer), which plays the icons, is installed with it.

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>

class, style and any other attribute go on the <svg>.

Live demos

Animated and static, outline and solid

<Heart />
<Heart solid />
<Heart animated={false} />
<Heart solid animated={false} />

Hover a figure to play it. The static ones don't move.

Click to play: getIconHandle

Driven by state

Play from code

---
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>

Astro components render once on the server, so there is no play prop. getIconHandle(svg) from pulsoicon-astro/client gives the icon's startAnimation() and stopAnimation(); both return a promise that resolves when the motion has finished.

Props

PropTypeDefaultWhat it does
sizenumber | string24Width and height; numbers are pixels
colorstringcurrentColorStroke colour, and fill colour when solid
strokeWidthnumber | string2Stroke width on the 24-unit grid
absoluteStrokeWidthbooleanfalseKeep the stroke the same number of pixels at any size
solidbooleanfalseThe filled drawing instead of the outline
animatedbooleantruefalse makes the icon completely still: nothing plays it, not getIconHandle()
autoAnimatedbooleantruePlay on hover / focus of the closest button, link, label or tab. false turns that off; getIconHandle() still works

All 9,955 Astro icons by category

Search all icons