Marquee
A customizable marquee effect for scrolling content horizontally or vertically
Installation
Run the following command
It will create a new file Marquee.tsx
inside the components/effects
directory.
Paste the code
Open the newly created file and paste the following code:
Add the required CSS animations
You can add the animations in one of two ways:
Option 1: Global CSS
Add these animations to your global CSS file:
Option 2: Tailwind Config
Add these keyframes to your tailwind.config.js
:
Props
Prop | Type | Default | Description |
---|---|---|---|
className | string | undefined | Additional CSS classes to apply |
reverse | boolean | false | Reverses the scroll direction |
pauseOnHover | boolean | false | Pauses the animation when hovering |
vertical | boolean | false | Switches to vertical scrolling |
repeat | number | 4 | Number of times to repeat the content |
children | React.ReactNode | required | Content to be scrolled |
CSS Variables
Variable | Default | Description |
---|---|---|
--duration | 40s | Animation duration |
--gap | 1rem | Gap between repeated elements |
Usage
Vertical Marquee
Custom Speed
You can adjust the animation speed by modifying the --duration
CSS variable:
Credits
Built by Bossadi Zenith