@fxshelf/button-kit
Animated button shelf for React and Vue — switch styles by variant string. Zero animation-lib deps. Copy-as-source friendly.
503
| Install | |
|---|---|
npm install @fxshelf/button-kit |
|
| Latest Version: | 0.1.0 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Sep 13, 2026 |
| Links: | GitHub · npm |
Maintainer: zhaotianlu
@fxshelf/button-kit
面向 React / Vue 的按钮动效书架 —— 用 variant 字符串切换样式。零 Framer / GSAP 依赖。
属于 fxshelf 动效书架中的一个可独立安装包。
| 文档 / Demo | luzhaotian.github.io/fxshelf |
| npm | @fxshelf/button-kit@0.1.0 |
| CDN | unpkg · jsDelivr |
支持 npm、CDN <script>、复制源码。详细用法见站点文档或 docs/使用说明.md。
安装
npm install @fxshelf/button-kit
记得引入样式:
import '@fxshelf/button-kit/styles.css'
| 使用方 | Peer |
|---|---|
| React | react / react-dom ≥ 18 |
| Vue | vue ≥ 3.3,且能编译 .vue(如 Vite) |
用法 — React
import { Button } from '@fxshelf/button-kit'
import '@fxshelf/button-kit/styles.css'
export function Example() {
return <Button variant="glow">继续</Button>
}
用法 — Vue
入口为源码 SFC:@fxshelf/button-kit/vue。
<script setup lang="ts">
import { Button } from '@fxshelf/button-kit/vue'
import '@fxshelf/button-kit/styles.css'
</script>
<template>
<Button variant="neon">继续</Button>
</template>
variant
| 值 | 效果 |
|---|---|
solid |
实心深色 |
outline |
描边,悬停填实 |
soft |
浅色软按钮 |
glow |
呼吸光晕 |
neon |
霓虹描边 |
shimmer |
悬停扫光 |
chroma |
炫彩流光;hover 贴边高斯光晕 |
liquid |
底部液体升起填充 |
wipe |
斜向擦除填充 |
glass |
毛玻璃半透明 |
未知字符串会回退到 solid。
用法 — CDN(React 18 UMD)
自包含产物 dist/button-kit.iife.js,全局 ButtonKit。完整示例:docs/CDN示例.html。
<link rel="stylesheet" href="https://unpkg.com/@fxshelf/button-kit/dist/index.css" />
<script crossorigin src="https://unpkg.com/react@18.3.1/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/@fxshelf/button-kit/dist/button-kit.iife.js"></script>
<div id="app"></div>
<script>
ReactDOM.createRoot(document.getElementById('app')).render(
React.createElement(ButtonKit.Button, { variant: 'glow' }, '继续'),
)
</script>
生产环境建议锁定版本,如 @fxshelf/button-kit@0.1.0/...。
不要用 jsDelivr GitHub gh/.../dist 直链(dist/ 不进 Git)。
复制源码
不经过 npm 时,从本包 src/(或 node_modules/@fxshelf/button-kit/)拷贝:
core/ # 必拷(含 styles.css)
react/ # React 项目
vue/ # Vue 项目
保持 core 与 react / vue 同级,然后:
// React
import { Button } from './components/button-kit/react'
import './components/button-kit/core/styles.css'
// Vue
import { Button } from './components/button-kit/vue'
import './components/button-kit/core/styles.css'
License
MIT
Related Packages
@fxshelf/word-tunnel
3D keyword tunnel word-cloud for React and Vue — perspective fly-through text. Z...
360
0
@fxshelf/starfield
Canvas 2D starfield tunnel for React and Vue — perspective fly-through, glitter...
302
0
@fxshelf/glyph-rain
Matrix-style glyph rain with cursor stir and drop-head lighting for React and Vu...
295
0
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.1.0 | >=3.3 | MIT |