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-astroAstro 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
| Prop | Type | Default | What it does |
|---|---|---|---|
size | number | string | 24 | Width and height; numbers are pixels |
color | string | currentColor | Stroke colour, and fill colour when solid |
strokeWidth | number | string | 2 | Stroke width on the 24-unit grid |
absoluteStrokeWidth | boolean | false | Keep the stroke the same number of pixels at any size |
solid | boolean | false | The filled drawing instead of the outline |
animated | boolean | true | false makes the icon completely still: nothing plays it, not getIconHandle() |
autoAnimated | boolean | true | Play on hover / focus of the closest button, link, label or tab. false turns that off; getIconHandle() still works |
Popular Astro icons
All 9,955 Astro icons by category
- Accessibility 85
- Account 141
- Animals 46
- Arrows 446
- Brand logos 3,042
- Buildings 110
- Charts 78
- Communication 205
- Connectivity 100
- Cursors 94
- Design 545
- Development 388
- Devices 577
- Emoji 92
- Files 348
- Finance 186
- Food & beverage 173
- Gaming 176
- Home 155
- Layout 834
- Letters & digits 465
- Mail 31
- Math 156
- Medical 125
- Multimedia 353
- Nature 91
- Navigation 328
- Notifications 67
- People 36
- Photography 133
- Science 56
- Seasons 8
- Security 93
- Shapes 227
- Shopping 215
- Social 132
- Sports 98
- Sustainability 23
- Text 457
- Time 73
- Tools 66
- Transportation 159
- Travel 85
- Weather 95
- Other 295