The Hero Badge component provides an elegant way to highlight important information or links with smooth animations and hover effects. Perfect for announcements, feature highlights, or call-to-action elements.
Installation
Examples
Usage
Basic Usage
Variants
Sizes
Customization
Custom Animation Settings
Custom Icon Animation
Custom Styling
Notes
- Built with Framer Motion for smooth animations
- Uses React Server Components (RSC) with "use client" directive
- Responsive design with mobile-first approach
- Interactive hover animations
- TypeScript support with proper types
- Supports custom styling and theming
- Optimized performance with proper hooks usage
Features
- Smooth entrance animations
- Icon rotation on hover
- Multiple size variants
- Multiple style variants
- Link and button functionality
- Customizable icons
- Responsive design
- Accessibility features
Props
Prop | Type | Default | Description |
---|---|---|---|
text | string | - | The text content of the badge |
href | string | - | Optional URL for the badge to link to |
icon | ReactNode | - | Optional icon component to display before the text |
endIcon | ReactNode | - | Optional icon component to display after the text |
variant | "default" | "outline" | "ghost" | "default" | The visual style variant of the badge |
size | "sm" | "md" | "lg" | "md" | The size of the badge |
className | string | - | Additional CSS classes to apply |
onClick | () => void | - | Optional click handler (used when no href is provided) |