motionicon 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +169 -0
- package/dist/index.d.mts +1173 -0
- package/dist/index.d.ts +1173 -0
- package/dist/index.js +12477 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +12103 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +61 -0
package/README.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<picture>
|
|
2
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ncklrs/motionicons/main/.github/logo-dark.svg">
|
|
3
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ncklrs/motionicons/main/.github/logo-light.svg">
|
|
4
|
+
<img alt="MotionIcons" src="https://raw.githubusercontent.com/ncklrs/motionicons/main/.github/logo-dark.svg" width="320">
|
|
5
|
+
</picture>
|
|
6
|
+
|
|
7
|
+
# MotionIcons
|
|
8
|
+
|
|
9
|
+
A comprehensive library of **350 animated SVG icons** powered by [Motion](https://motion.dev) for React. Beautiful, customizable icons with built-in animations that bring your UI to life.
|
|
10
|
+
|
|
11
|
+
[](https://www.npmjs.com/package/motionicon)
|
|
12
|
+
[](https://opensource.org/licenses/MIT)
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- **350 Icons** — Comprehensive icon set covering UI, navigation, media, commerce, and more
|
|
17
|
+
- **9 Motion Types** — Scale, rotate, translate, shake, pulse, bounce, draw, spin, and none
|
|
18
|
+
- **4 Trigger Modes** — Hover, loop, mount, and inView animations
|
|
19
|
+
- **Fully Typed** — Complete TypeScript support with exported types
|
|
20
|
+
- **Tree Shakeable** — Import only what you need
|
|
21
|
+
- **Customizable** — Control size, stroke width, colors, and animation behavior
|
|
22
|
+
- **Context Support** — Global configuration via IconProvider
|
|
23
|
+
- **Accessible** — ARIA labels and reduced motion support
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install motionicon motion react react-dom
|
|
29
|
+
# or
|
|
30
|
+
pnpm add motionicon motion react react-dom
|
|
31
|
+
# or
|
|
32
|
+
yarn add motionicon motion react react-dom
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { Heart, Star, Bell } from 'motionicon'
|
|
39
|
+
|
|
40
|
+
function App() {
|
|
41
|
+
return (
|
|
42
|
+
<div>
|
|
43
|
+
{/* Scale animation on hover (default) */}
|
|
44
|
+
<Heart size={24} motionType="scale" />
|
|
45
|
+
|
|
46
|
+
{/* Continuous rotation */}
|
|
47
|
+
<Star size={32} motionType="rotate" trigger="loop" />
|
|
48
|
+
|
|
49
|
+
{/* Draw animation on hover */}
|
|
50
|
+
<Bell size={24} motionType="draw" />
|
|
51
|
+
</div>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Motion Types
|
|
57
|
+
|
|
58
|
+
| Type | Description |
|
|
59
|
+
|------|-------------|
|
|
60
|
+
| `scale` | Grows larger on trigger (default) |
|
|
61
|
+
| `rotate` | Rotates 360 degrees |
|
|
62
|
+
| `translate` | Moves up slightly |
|
|
63
|
+
| `shake` | Shakes horizontally |
|
|
64
|
+
| `pulse` | Pulses in size |
|
|
65
|
+
| `bounce` | Bounces up and down |
|
|
66
|
+
| `draw` | SVG path drawing effect |
|
|
67
|
+
| `spin` | Continuous spinning |
|
|
68
|
+
| `none` | No animation |
|
|
69
|
+
|
|
70
|
+
## Trigger Modes
|
|
71
|
+
|
|
72
|
+
| Trigger | Description |
|
|
73
|
+
|---------|-------------|
|
|
74
|
+
| `hover` | Animates on mouse hover (default) |
|
|
75
|
+
| `loop` | Continuous animation |
|
|
76
|
+
| `mount` | Animates once when component mounts |
|
|
77
|
+
| `inView` | Animates when scrolled into viewport |
|
|
78
|
+
|
|
79
|
+
## Props
|
|
80
|
+
|
|
81
|
+
All icons accept the following props:
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
interface IconProps {
|
|
85
|
+
size?: number // Icon size in pixels (default: 24)
|
|
86
|
+
strokeWidth?: number // Stroke width (default: 2)
|
|
87
|
+
className?: string // Additional CSS classes
|
|
88
|
+
motionType?: MotionType // Animation type
|
|
89
|
+
trigger?: TriggerType // When to trigger animation
|
|
90
|
+
animated?: boolean // Enable/disable animations
|
|
91
|
+
'aria-label'?: string // Accessibility label
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Global Configuration
|
|
96
|
+
|
|
97
|
+
Use `IconProvider` to set defaults for all icons in your app:
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
import { IconProvider, Heart, Star } from 'motionicon'
|
|
101
|
+
|
|
102
|
+
function App() {
|
|
103
|
+
return (
|
|
104
|
+
<IconProvider config={{
|
|
105
|
+
animated: true,
|
|
106
|
+
defaultSize: 28,
|
|
107
|
+
defaultStrokeWidth: 1.5
|
|
108
|
+
}}>
|
|
109
|
+
{/* All icons inherit these defaults */}
|
|
110
|
+
<Heart />
|
|
111
|
+
<Star />
|
|
112
|
+
</IconProvider>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Accessibility
|
|
118
|
+
|
|
119
|
+
MotionIcons respects `prefers-reduced-motion` by default. You can also manually control animations:
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
// Disable animations for this icon
|
|
123
|
+
<Heart animated={false} />
|
|
124
|
+
|
|
125
|
+
// Add accessible label
|
|
126
|
+
<Heart aria-label="Favorite" />
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Available Icons
|
|
130
|
+
|
|
131
|
+
MotionIcons includes 350 icons across categories:
|
|
132
|
+
|
|
133
|
+
- **Navigation** — Arrows, chevrons, menu, home
|
|
134
|
+
- **Actions** — Check, close, edit, save, trash
|
|
135
|
+
- **Media** — Play, pause, volume, camera, video
|
|
136
|
+
- **Communication** — Mail, phone, message, send
|
|
137
|
+
- **Commerce** — Cart, credit card, package, receipt
|
|
138
|
+
- **Files** — File, folder, clipboard, archive
|
|
139
|
+
- **Weather** — Sun, cloud, rain, snow, wind
|
|
140
|
+
- **Health** — Heart, pill, stethoscope, brain
|
|
141
|
+
- **Devices** — Laptop, phone, monitor, keyboard
|
|
142
|
+
- **And many more...**
|
|
143
|
+
|
|
144
|
+
## Development
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Install dependencies
|
|
148
|
+
pnpm install
|
|
149
|
+
|
|
150
|
+
# Start dev server (showcase site)
|
|
151
|
+
pnpm dev
|
|
152
|
+
|
|
153
|
+
# Build library
|
|
154
|
+
pnpm run build:lib
|
|
155
|
+
|
|
156
|
+
# Type check
|
|
157
|
+
pnpm run type-check
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Tech Stack
|
|
161
|
+
|
|
162
|
+
- **React 18+** with Motion for animations
|
|
163
|
+
- **TypeScript** with strict mode
|
|
164
|
+
- **ESM and CJS** builds via tsup
|
|
165
|
+
- **Next.js 15** for the showcase site
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
MIT License - see [LICENSE](LICENSE) for details.
|