Shimmer Button
A button component with an animated shimmer effect that continuously slides across the button surface, creating a shimmering spotlight that rotates around the button. This sophisticated effect adds a premium, polished look to your interactive elements.Installation
Usage
Examples
Basic Usage
Custom Shimmer Color
Custom Background
Fast Animation
Fully Customized
Props
The content to display inside the button.
Additional CSS classes to apply to the button.
The color of the shimmer effect. Accepts any valid CSS color value (hex, rgb, hsl, etc.).
The size/width of the shimmer spark. Smaller values create a tighter spotlight effect.
The border radius of the button. Accepts any valid CSS border-radius value.
The duration of one complete shimmer cycle. Accepts any valid CSS duration value.
The background color or gradient of the button. Accepts any valid CSS background value.
All standard HTML button attributes are supported (onclick, disabled, type, etc.).
Component Details
Animation Architecture
The Shimmer Button creates its effect through a sophisticated multi-layer animation:- Rotating Spark: A conic gradient rotates continuously
- Sliding Motion: The spark container slides across the button
- Blur Effect: A 2px blur softens the shimmer edges
- Highlight Layer: An inset shadow creates depth and dimension
- Press Feedback: Scale animation on active state
Keyframe Animations
The component requires two CSS keyframes (automatically included via registry):CSS Variables
The component uses these CSS custom properties for easy customization:--spread: Angle of the conic gradient (default: 90deg)--shimmer-color: Color of the shimmer effect--radius: Border radius--speed: Animation duration--cut: Size of the shimmer spark--bg: Background color/gradient
Layer Structure
The button consists of multiple stacked layers:Container Query
The component uses container queries (@container) for responsive shimmer sizing:
Dependencies
- Tailwind CSS - For styling and base animations
- Modern CSS features - Container queries, CSS variables
Accessibility
The shimmer effect is purely decorative and doesn’t affect button functionality:- Semantic
<button>element - Full keyboard support
- Screen reader compatible
- Clear focus states
- Active state with scale feedback
- All ARIA attributes supported
Use Cases
The Shimmer Button is ideal for:- Premium features: Highlight pro or paid functionality
- Call-to-action: Draw attention to primary actions
- Hero sections: Create visual interest in landing pages
- Success states: Celebrate completed actions
- Luxury brands: Add sophistication to high-end interfaces
Performance Notes
The component is optimized for performance:- Hardware acceleration: Uses
transformandtranslateZ(0) - Layered composition: Separate layers prevent repaints
- Blur optimization: Limited to a small area
- Container queries: Efficient responsive behavior
Multiple Instances
Multiple shimmer buttons on the same page perform well due to CSS animation efficiency. Each button’s animation is independent and hardware-accelerated.Browser Compatibility
The component requires container queries support for optimal rendering. All modern browsers support this feature.
- Chrome/Edge 105+
- Safari 16+
- Firefox 110+