Preact 10.11+ · pulsoicon-preact
PulsoIcon for Preact
Every demo on this page is a Preact component rendered by Preact, with the icons from pulsoicon-preact. They draw exactly the same SVG as the React package and move the same way.
Install
npm install pulsoicon-preactPreact 10.11 or newer. Motion (12 or newer), which plays the icons, is installed with it. No preact/compat alias needed.
Quick start
import { Bell, Calendar, Trash2 } from "pulsoicon-preact";
export function Toolbar() {
return (
<>
<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: a ref
Not saved yet
Driven by state: play
Props, live
<Heart size={48} color="#f2552c" />Play from code
import { useRef } from "preact/hooks";
import { Check, type IconHandle } from "pulsoicon-preact";
export function SaveButton() {
const check = useRef<IconHandle>(null);
return (
<button onClick={() => check.current?.startAnimation()}>
<Check ref={check} autoAnimated={false} /> Save
</button>
);
}startAnimation() and stopAnimation() both return a promise that resolves when the motion has finished. Or bind state: <Bell autoAnimated={false} play={hasUnread} />.
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 the ref and not play |
autoAnimated | boolean | true | Play on hover / focus of the closest button, link, label or tab. false turns that off; the ref and play still work |
play | boolean | — | true plays the motion, false returns to rest |
Popular Preact icons
All 9,955 Preact 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