Skip to content
项目

关于

Pretty and customizable svg spinners for React.js

网站与应用开发

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Respinner

npm-version

react components for spinners or loaders. Each loader was combined css animation and render dom as svg. easily controlled by react porps.

You could change the count of spinner's children by props count, also the color of themselves. All of them built with SVG, so you can easily scale them with width and height.

Examples

demo

See more details in demo directory or visit website

Usage

npm install --save respinner

Just import it when use with react. Issues go to issues.

Basic

import React from 'react'
import {
  BeatLoading, BounceLoading, CircularLoading,
  ClockLoading, RotateLoading, SpinLoading,
  WaveLoading, DashLoading, CopperLoading
} from 'respinner'

function LoadingComponents() {
  <div className="spinners">
    <SpinLoading color="#777" borderRadius={4} count={12} /> // use with color prop
    <CircularLoading color="#3b82f6" /> // color sets both fill and stroke
    <BeatLoading fill="#999" /> // or use fill/stroke directly
  </div>
}

Use with SVG use

// pre-define a spinner
<SpinLoading borderRadius={2} count={10} id="spin" />

// reuse them
<svg width="40"><use href="#spin" fill="#fff" /></svg>
<svg width="40"><use href="#spin" fill="#fff" /></svg>

API

Any SVG props could be used in these components. All components support a color prop that sets both fill and stroke properties. If color is specified, it takes precedence over fill or stroke props.

The following are the default props for these components:

1. BeatLoading
  • gap: 6
  • size: 8
  • count: 6
  • duration: 0.8
  • color: Sets fill (prefers color over fill)
2. CircularLoading
  • size: 40
  • strokeWidth: 4
  • linecap: 'round'
  • color: Sets stroke (prefers color over stroke)
3. BounceLoading
  • gap: 6
  • count: 4
  • barWidth: 4
  • barHeight: 16
  • duration: 0.8
  • color: Sets fill (prefers color over fill)
4. RotateLoading
  • size: 40
  • opacity: 0.2
  • strokeWidth: 4
  • color: Sets stroke (prefers color over stroke)
5. SpinLoading
  • size: 40
  • count: 8
  • barWidth: 4
  • duration: 1
  • barHeight: 10
  • borderRadius: 1
  • color: Sets fill (prefers color over fill)
6. WaveLoading
  • size: 40
  • count: 3
  • duration: 1.5
  • strokeWidth: 2
  • color: Sets stroke (prefers color over stroke)
7. ClockLoading
  • size: 40
  • duration: 2
  • strokeWidth: 2
  • color: Sets stroke (prefers color over stroke)
8. DashLoading
  • size: 40
  • duration: 1.8
  • strokeWidth: 4
  • color: Sets stroke (prefers color over stroke)
9. CopperLoading
  • size: 40
  • strokeWidth: 4
  • color: Sets both fill and stroke (prefers color over fill/stroke)

Development

pnpm install
pnpm dev

# see demo in http://localhost:3000

Build

pnpm run build # build lib
pnpm run build:docs # build docs

License

MIT

探索相关项目

加载中…