PulsoIcon-Package README

项目的 README,来自 github.com/CityPulso/PulsoIcon-Package。合并为一个 markdown 文件:README.md。

PulsoIcon

PulsoIcon

9955 animated icons. Every one has its own motion.
For React, Vue, Svelte, Solid, Preact, Angular, Astro, Jetpack Compose and SwiftUI. Icons come alive on hover; in React they replace lucide-react in one line.

npm version npm downloads license

pulsoicon.com: browse all icons, try them live and copy the code · Playground · Documentation

Docs: React · Vue · Svelte · Solid · Preact · Angular · Astro · Android (Compose) · iOS / macOS (SwiftUI) · Core data


PulsoIcon icons animating on hover

A bell rings. A calendar lifts its rings. A trash can opens its lid. A clock's hand goes round.

PulsoIcon gives every icon a motion written for that icon, not one effect stamped on all of them. At rest each icon is a clean 24×24 icon; it plays when someone hovers or focuses the button, link or tab it sits in.

Every one of the 9955 motions is written for this set. About 3,700 icons are drawn here, including the line-art brand logos; the rest build on the shapes of Lucide, Tabler Icons and Iconoir, which are credited in LICENSE.

Why PulsoIcon

Packages

One version number covers every package.

Platform Install Guide
React 18+ npm install pulsoicon-react React README
Vue 3.5+ npm install pulsoicon-vue Vue README
Svelte 5 npm install pulsoicon-svelte Svelte README
Solid 1.8+ npm install pulsoicon-solid Solid README
Preact 10.11+ npm install pulsoicon-preact Preact README
Angular 19+ npm install pulsoicon-angular Angular README
Astro 5+ npm install pulsoicon-astro Astro README
Android (Jetpack Compose) implementation("com.citypulso:pulsoicon-compose:<version>") Android README
iOS / macOS (SwiftUI) .package(url: "https://github.com/CityPulso/PulsoIcon-Package.git", from: "<version>") iOS / macOS README
Any other framework npm install pulsoicon-core Core README

Each guide has the install, a quick start, every prop and how to play icons from code on that platform.

pulsoicon-core holds the icon data the web packages share; they install it for you. Until 5.2.1 the React package was called pulsoicon; from 6.0.1 it is pulsoicon-react (only the import changes).

Quick start

React (full guide):

import { Bell, Trash2 } from "pulsoicon-react";

<button><Bell size={20} /> Notifications</button>
<button><Trash2 color="crimson" strokeWidth={1.5} /> Delete</button>

Vue (full guide):

<script setup lang="ts">
import { Bell } from "pulsoicon-vue";
</script>

<template>
  <button><Bell :size="20" /> Notifications</button>
</template>

Svelte (full guide):

<script lang="ts">
  import { Bell } from "pulsoicon-svelte";
</script>

<button><Bell size={20} /> Notifications</button>

Solid (full guide) and Preact (full guide) take the same JSX as React, imported from pulsoicon-solid or pulsoicon-preact.

Angular (full guide):

import { Bell, PulsoIconComponent } from "pulsoicon-angular";

@Component({
  imports: [PulsoIconComponent],
  template: `<button><pulso-icon [icon]="Bell" size="20" /> Notifications</button>`,
})
export class Toolbar {
  protected readonly Bell = Bell;
}

Astro (full guide):

---
import Bell from "pulsoicon-astro/icons/bell";
---

<button><Bell size={20} /> Notifications</button>

Jetpack Compose (full guide):

val interactions = remember { MutableInteractionSource() }
IconButton(onClick = { /* … */ }, interactionSource = interactions) {
    PulsoIcon(PulsoIcons.Bell, contentDescription = "Notifications", interactionSource = interactions)
}

SwiftUI (full guide):

Button { /* … */ } label: {
    Label { Text("Notifications") } icon: { PulsoIconView(.bell, size: 20) }
}

Hover the button (press it, on Android) and its icon plays.

Props

Every package takes the same props, with the same defaults and meaning (Kotlin and Swift spell the types their own way).

Prop Type Default Description
size number | string 24 Width and height
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 Filled icon instead of outline (see Solid icons)
animated boolean true false makes the icon fully static: nothing plays it, not even the ref or play
autoAnimated boolean true Play the built-in hover / focus trigger. false turns that off; the ref and play still work
play boolean true plays the motion, false returns to rest. Works with or without autoAnimated

On the web, any other SVG attribute (className / class, style, aria-label, …) is passed to the <svg>. Icons render with aria-hidden="true"; give the surrounding button or link a label.

When the animation plays

On the web, an icon plays when the pointer enters, or focus moves into, its closest button, a, label, summary, [role="button"], [role="link"], [role="tab"] or [role="menuitem"]. If there is none, the icon plays on its own hover.

Any other element can become the trigger with data-icon-trigger:

<div className="card" data-icon-trigger>
  <MapPin /> 3 venues near you
</div>

On Android the icon plays with the control whose interactionSource you pass; on Apple platforms, while a pointer hovers it. Everywhere, play and the handle (ref, bind:this, rememberPulsoIconHandle(), PulsoIconHandle) play it from code, and nothing moves when the system asks for reduced motion.

Solid icons

solid draws the filled version of an icon, in color:

<Heart solid color="crimson" />

About 1,700 icons have a filled drawing taken from the Tabler filled set or the Phosphor fill weight. Their source file has a solid list and a "Solid from …" comment. The other icons fill their closed outline shapes and cut their inner lines out of the fill, so the details stay visible. Motions that draw a stroke on (draw, redraw, …) pop in instead on filled shapes.

Finding icons

Other names

Icons also answer to the names other icon sets use: Gear is Settings, Magnifier is Search, Cart is ShoppingCart, World is Globe, DotsHorizontal is Ellipsis, and so on. Every icon is also exported with an Icon suffix (BellIcon).

Brand logos

Brand icons start with Brand (BrandGithub, BrandSlack, BrandOpenai, …). The brands added up to 3.1 are also exported without the prefix (Github, Slack); the ones added in 4.0 only with it, because many brand names are ordinary words. They are simplified line drawings made for this set, most of the newer ones drawn after the logos collected by Simple Icons.

All product names, logos and brands are the property of their respective owners and are used here only to refer to those products or services. Their use does not imply endorsement. Follow each brand's own guidelines when you use its logo.

All icons at once

Every icon also has a kebab-case name (party-popper), the same on every platform, for storing on your data. The web packages export ICONS / ICON_NAMES from <package>/all, the names alone from <package>/names and one icon from <package>/icons/<name>; Compose has PulsoIcons.byKey("party-popper") and SwiftUI PulsoIcon.byKey("party-popper").

Report a wrong icon

If an icon is drawn wrong, a brand logo doesn't match the real one, or a motion looks off, please email [email protected] with the icon name (for example brand-avianca) and, if you can, a screenshot or a link to the correct logo. Issues on GitHub are welcome too.

Contributing

npm install
npm run preview          # every gallery at once: React :10205, Vue :10206, Svelte :10207, Solid :10208,
                         # Preact :10209, Angular :10210, Astro :10211 (npm run preview -- vue for just one)
npm run gen              # after editing an icon: rewrites every platform's icon files from packages/core
npm test
npm run build

Each icon is one data file in packages/core/src/icons/<name>.ts, shared by every platform: the shapes of the icon and, for each shape, an optional motion (r recipe from packages/core/src/recipes.ts, d delay, x/y direction, a amplitude, o pivot point on the 24×24 grid). Edit that file to change how an icon moves, then run npm run gen. Other names live in packages/core/src/aliases.ts.

Folder What
packages/core pulsoicon-core: the icons, recipes, solid drawings and the framework-free player
packages/react, vue, svelte, solid, preact, astro The web packages; their icon files are generated and committed
packages/angular The Angular library, built by ng-packagr; npm publishes its dist/
kotlin/ The Android library (Gradle); icons/ is generated and committed
swift/ and Package.swift The Swift package; Icons/ is generated and committed
preview/ One gallery per web framework; preview/shared holds what they share

The Kotlin and Swift recipes are written by hand; their tests check them against packages/core (kotlin/: ./gradlew :pulsoicon:testDebugUnitTest; Swift: swift test). npm run test:browser plays icons in Chromium through React, Vue, Svelte, Solid and Preact side by side and checks that they move the same.

Releasing

package.json at the root holds the one version of every package. npm run set-version -- 6.1.0 sets it everywhere; push that to main and CI publishes the npm packages and the Maven artifact that are not out yet, then tags 6.1.0 for Swift Package Manager.

License

PulsoIcon is open source under the ISC license © CityPulso.

What is ours, and what comes from other icon sets

Part Origin
Every animation (how each icon moves) Written for PulsoIcon
Runtime code (every package's components, triggers, motion recipes) Written for PulsoIcon
About 3,700 icons, including about 2,770 line-art brand logos Drawn for PulsoIcon
Shapes of the 2020 Lucide icons Based on Lucide (ISC; some derived from Feather, MIT)
Shapes of the icons marked "Adapted from Tabler Icons" Based on Tabler Icons (MIT)
Shapes of the icons marked "Adapted from Iconoir" Based on Iconoir (MIT)
Five icons marked "Adapted from Hugeicons" Adapted from Hugeicons (MIT)
Icons marked "Drawn after Phosphor Icons" Redrawn after Phosphor shapes (MIT)
Solid shapes marked "Solid from Tabler Icons" / "Solid from Phosphor Icons" Taken from the Tabler filled set and the Phosphor fill weight (MIT)
Brand icons marked "Drawn after Simple Icons" Drawn after the logos collected by Simple Icons (CC0)

Icons based on or drawn after Tabler Icons, Iconoir, Hugeicons, Phosphor or Simple Icons name their source in a comment at the top of their file; the Lucide icons keep their Lucide names. The full license texts are in LICENSE.

Using PulsoIcon in your project

You may use PulsoIcon freely, including in commercial and closed-source products. The one condition, from ISC and the MIT licenses of the sets above, is the notice:

Brand logos are trademarks of their owners. Using a brand icon doesn't imply endorsement, and you should follow each brand's own guidelines.

PulsoIcon-Package (CityPulso/PulsoIcon-Package)

正在搜索数据库…

这是什么?一套面向 React、Vue、Svelte、Jetpack Compose 和 SwiftUI 的动态图标库,共约 9955 个图标。每个图标都有自己的悬停动效,其中包括 Lucide 图标和品牌标志。
这是图标字体,还是要导入代码的库?是库。每个图标都是一个可以导入的组件。在 React 中,它可以直接替换 lucide-react,组件名和 props 都保持不变。
我的 React 项目怎么切换到它?运行 'npm install pulsoicon-react',然后把 lucide-react 的导入语句改掉即可。组件名和 props 不变,所以通常只需要修改导入。5.2.1 及之前的版本,React 包叫 'pulsoicon',因此较旧的教程可能还在使用这个名字。
品牌标志有什么需要注意的地方吗?品牌图标都以 Brand 开头,例如 BrandGithub。4.0 版本新增的品牌需要带这个前缀;3.1 及之前添加的品牌不带前缀也能使用。这些标志是简化的重绘版本,商标归各自的所有者所有,使用前请查看该品牌自己的使用规范。
Vue、Svelte、Android 或 iOS 分别要安装什么?Vue 3.5+:'npm install pulsoicon-vue'。Svelte 5:'npm install pulsoicon-svelte'。Android:通过 Gradle 安装 Jetpack Compose 包 'com.citypulso:pulsoicon-compose'。iOS 和 macOS:使用 SwiftUI 的 Swift 包。其他任何框架:'npm install pulsoicon-core'。
能否在商业闭源产品中使用?可以,遵循 ISC 许可证。发布时请附上 PulsoIcon 的 LICENSE 文件,该文件还包含 Lucide、Tabler、Iconoir、Hugeicons 和 Phosphor 的声明,例如可以放在第三方声明页面上。在界面中标注 PulsoIcon 是可选的。
能关闭动画,或者用代码启动动画吗?可以。animated={false} 会让图标完全静止。autoAnimated={false} 会关闭悬停触发。play 属性或 ref 句柄可以让代码启动和停止动画。
图标有填充版本吗?有。设置 solid 即可绘制彩色的填充版本。约 1,700 个图标来自 Tabler 或 Phosphor,具有真正的填充图形;其余图标会填充其闭合的轮廓形状,并保留内部线条可见。
这些图标从哪里来?约 3700 个是专门为本套图标绘制的,其中包括约 2770 个线稿品牌标志。其余图标基于 Lucide、Tabler Icons 和 Iconoir 的形状制作,这些项目在 LICENSE 文件中都有署名。
它会遵循“减少动态效果”的系统设置吗?会。当系统要求减少动态效果时,图标不会有任何动画,保持静止。
作者
CityPulso
大小
21.8 MB
星标
592
更新
提交Nov 13
时长
14天
提交 · 90 天