跳到主要内容
ZH

5 个图标 · MIT 许可

图表动态图标

柱状图、饼图和趋势箭头,适用于数据分析和报表。上升和下降趋势图标能让人一眼看出指标是涨是跌,很适合 KPI 卡片和数字变化记录。

全部 5 个图标都悬停时播放一次。每个图标都提供 React 组件、shadcn/ui 组件和 Lottie JSON 动画,并附带静态 SVG,可依据 MIT 许可证免费用于商业项目。

全部图表图标

适用场景

  • 显示指标涨跌的 KPI 卡片
  • 数据分析和报表的导航项
  • 仪表盘的空状态
  • 财务和投资组合概览

按交互方式

  • 悬停播放动态图标 · 5

    在 mouseenter 时播放一次,除非用户偏好减少动态效果。移出不会中断播放,播放期间再次移入也不会重新开始。Bar Chart, Bar Chart 2, Pie Chart, Trending Down, Trending Up.

添加到您的应用

在 React 中,安装 react-useanimations 并导入图标即可,它会自动播放“悬停重播”交互。本类别的所有图标用法都一样:把 trendingUp 换成图标页面上的名称。

npm install react-useanimations
import UseAnimations from 'react-useanimations';
import trendingUp from 'react-useanimations/lib/trendingUp';

<UseAnimations animation={trendingUp} size={32} />

使用 shadcn/ui 时,CLI 会添加一个现成的组件:

npx shadcn@latest add https://useanimations.com/r/trending-up.json
import { AnimatedTrendingUp } from '@/components/animations/trending-up';

<AnimatedTrendingUp size={24} />

没有使用 React?每个图标都是位于 /icons/<id>.json 的 Lottie JSON 文件;网页、iOS、Android 和 Flutter 的播放器用法请参阅 Lottie 图标。

常见问题

包含哪些图表动态图标?

共 5 个图标:Bar Chart、Bar Chart 2、Pie Chart、Trending Down 和 Trending Up。全部可依据 MIT 许可证免费用于个人和商业项目,无需署名。

如何在 React 中使用这些图表动态图标?

安装 react-useanimations,添加 import trendingUp from 'react-useanimations/lib/trendingUp',然后渲染 <UseAnimations animation={trendingUp} size={32} />。图标会播放它的“悬停重播”交互,并跟随文字颜色。使用 shadcn/ui 时,改为运行 npx shadcn@latest add https://useanimations.com/r/trending-up.json。

不用 React 也能使用这些图表动态图标吗?

可以。每个图标都是一个 Lottie JSON 文件,地址为 https://useanimations.com/icons/<id>.json(例如 https://useanimations.com/icons/trending-up.json),可以用 lottie-web、lottie-ios、lottie-android 或 Flutter 的 lottie 包播放;静态 SVG 可以在各个图标页面(英文)下载。这些图标都没有用到表达式,因此 lottie-web 的轻量版(light build)就够用了。