Installation
Usage
Examples
Basic Usage
Custom Gradient Colors
Custom Height
Bottom Position
Props
Additional CSS classes to apply to the component. Use this to customize the gradient colors, height, or position.
Features
- Fixed position at the top of the viewport
- Animated width based on scroll progress
- Beautiful gradient color transition by default
- Smooth animation using motion-sv
- Fully customizable via Tailwind classes
Default Styling
By default, the component includes:- Fixed position at top of viewport (
fixed inset-x-0 top-0) - High z-index for visibility (
z-50) - 4px height (
h-1) - Gradient from purple to pink to orange (
from-[#A97CF8] via-[#F38CB8] to-[#FDCC92]) - Origin at top-left for scale animation
How It Works
The component usesuseScroll() from motion-sv to track the scroll position. The scaleX style property is bound to scrollYProgress, which automatically updates as the user scrolls, creating a smooth progress indicator.
Dependencies
- motion-sv (for
useScrollandmotion.div)