celebration-flip
Version:
A beautiful animated flip text component for celebrating milestones with customizable text and hearts
243 lines (195 loc) โข 7.17 kB
Markdown
# ๐ CelebrationFlip
A beautiful animated flip text component for celebrating milestones with customizable text and hearts. Perfect for social media celebrations, milestone announcements, and achievement showcases.
<div align="center">
[](https://badge.fury.io/js/celebration-flip)
[](https://opensource.org/licenses/MIT)
[](https://bundlephobia.com/package/celebration-flip)
[](https://www.npmjs.com/package/celebration-flip)
</div>
## โจ Features
- ๐ฌ **Smooth flip animations** with CSS transforms and 60fps performance
- ๐จ **Fully customizable** - Colors, text, duration, and styling
- ๐ฑ **Responsive design** - Works perfectly on mobile, tablet, and desktop
- โก **Ultra lightweight** - Less than 5KB minified + gzipped
- ๐ง **Zero configuration** - Works out of the box with sensible defaults
- ๐ **Framework agnostic** - React, Vue, Svelte, or vanilla HTML/CSS
- โฟ **Accessibility first** - Respects `prefers-reduced-motion` and screen readers
- ๐ฏ **TypeScript ready** - Full type definitions included
- ๐ฆ **Multiple formats** - ESM, CommonJS, and UMD builds
- ๐จ **Retro aesthetic** - Uses the beautiful "Sixtyfour" pixel font
## ๐ฆ Installation
```bash
# npm
npm install celebration-flip
# yarn
yarn add celebration-flip
# pnpm
pnpm add celebration-flip
# bun
bun add celebration-flip
```
Or use it directly from CDN (no installation required):
```html
<!-- CSS -->
<link
rel="stylesheet"
href="https://unpkg.com/celebration-flip@latest/dist/styles.css"
/>
<!-- ESM -->
<script type="module">
import { CelebrationFlip } from "https://unpkg.com/celebration-flip@latest/dist/index.esm.js";
</script>
```
## ๐ Quick Start
### React Component
```jsx
import { CelebrationFlip } from "celebration-flip";
import "celebration-flip/dist/styles.css";
function App() {
return (
<div
style={{
background: "#111",
minHeight: "100vh",
display: "grid",
placeContent: "center",
}}
>
<CelebrationFlip
mainText="4000 SUSCRIPTORES"
secondaryText="ยกGRACIAS!"
primaryColor="dodgerblue"
secondaryColor="hotpink"
duration={3}
/>
</div>
);
}
```
### Vanilla HTML/CSS
```html
<html>
<head>
<link
rel="stylesheet"
href="https://unpkg.com/celebration-flip/dist/styles.css"
/>
<style>
body {
background: #111;
margin: 0;
min-height: 100vh;
display: grid;
place-content: center;
}
</style>
</head>
<body>
<div
class="celebration-flip"
style="--clr-1: dodgerblue; --clr-2: hotpink; --duration: 3s;"
>
<div class="flip-text">
<span>4</span><span>0</span><span>0</span><span>0</span><span></span>
<span>S</span><span>U</span><span>S</span><span>C</span><span>R</span
><span>I</span><span>P</span><span>T</span><span>O</span><span>R</span
><span>E</span><span>S</span>
</div>
<div class="flip-text">
<span>โฅ</span><span>โฅ</span><span>โฅ</span><span>โฅ</span><span></span>
<span>ยก</span><span>G</span><span>R</span><span>A</span><span>C</span
><span>I</span><span>A</span><span>S</span><span>!</span><span></span>
<span>โฅ</span><span>โฅ</span><span>โฅ</span><span>โฅ</span>
</div>
</div>
</body>
</html>
```
## ๐ API Reference
### Props (React)
| Prop | Type | Default | Description |
| ---------------- | -------- | -------------- | ------------------------------------------------ |
| `mainText` | `string` | **required** | Main text to display (e.g., "4000 SUSCRIPTORES") |
| `secondaryText` | `string` | **required** | Secondary text to display (e.g., "ยกGRACIAS!") |
| `primaryColor` | `string` | `"dodgerblue"` | Primary color for main text |
| `secondaryColor` | `string` | `"hotpink"` | Secondary color for hearts and secondary text |
| `duration` | `number` | `3` | Animation duration in seconds |
| `className` | `string` | `""` | Custom CSS class name |
### CSS Custom Properties (Vanilla)
| Property | Default | Description |
| ------------ | ------------ | --------------------------------------------- |
| `--clr-1` | `dodgerblue` | Primary color for main text |
| `--clr-2` | `hotpink` | Secondary color for hearts and secondary text |
| `--duration` | `3s` | Animation duration |
## ๐จ Examples
### Different Milestones
```jsx
// 1000 Followers
<CelebrationFlip
mainText="1000 FOLLOWERS"
secondaryText="THANK YOU"
primaryColor="#00ff88"
secondaryColor="#ff6b35"
/>
// 1M Views
<CelebrationFlip
mainText="1M VIEWS"
secondaryText="INCREDIBLE"
primaryColor="#ff0080"
secondaryColor="#8000ff"
duration={2}
/>
// 10K Likes
<CelebrationFlip
mainText="10K LIKES"
secondaryText="AMAZING"
primaryColor="gold"
secondaryColor="orange"
duration={4}
/>
```
### Custom Styling
```jsx
<CelebrationFlip
mainText="CUSTOM STYLE"
secondaryText="AWESOME"
primaryColor="linear-gradient(45deg, #ff6b6b, #4ecdc4)"
secondaryColor="linear-gradient(45deg, #45b7d1, #96ceb4)"
className="my-custom-celebration"
/>
```
```css
.my-custom-celebration {
filter: drop-shadow(0 0 20px rgba(255, 107, 107, 0.5));
}
```
## ๐ฏ Use Cases
- ๐ **Social Media Milestones** - Celebrate follower counts, likes, shares
- ๐ **Achievement Announcements** - App downloads, user registrations
- ๐ฐ **Business Metrics** - Revenue goals, customer milestones
- ๐ **Educational Platforms** - Course completions, student enrollments
- ๐ฎ **Gaming** - High scores, level completions
- ๐ **Analytics Dashboards** - KPI celebrations
## ๐ Browser Support
- โ
Chrome 60+
- โ
Firefox 55+
- โ
Safari 12+
- โ
Edge 79+
## โฟ Accessibility
The component respects the `prefers-reduced-motion` media query. Users who have requested reduced motion will see a static version without animations.
## ๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
## ๐ License
MIT ยฉ [Formmy Team](https://github.com/formmy)
## ๐ Links
- [GitHub Repository](https://github.com/blissito/celebration-flip)
- [NPM Package](https://www.npmjs.com/package/celebration-flip)
- [Report Issues](https://github.com/blissito/celebration-flip/issues)
---
Made with โค๏ธ by the [Formmy](https://formmy.ai) team