Please use Desktop to view and interact with components
Microinteractions2000mslinear
Shimmer Button
Button with continuous shimmer effect
buttonshimmergradientshadcn
Useto navigate between components
Preview
This component requires shadcn/ui
This component uses shadcn/ui components. Make sure you have shadcn/ui set up in your project.
- Install shadcn/ui:
npx shadcn-ui@latest init - Install required components based on the imports in the code (e.g.,
npx shadcn-ui@latest add button) - Ensure your
tailwind.config.tsandglobals.cssare configured as per shadcn/ui documentation
Code
TypeScript + React
'use client'
import { motion } from 'framer-motion'
import { Button } from '@/components/ui/button'
export function ShimmerButton() {
return (
<Button className="relative overflow-hidden">
<span className="relative z-10">Shimmer Effect</span>
<motion.div
className="absolute inset-0 -translate-x-full bg-gradient-to-r from-transparent via-white/20 to-transparent"
animate={{
x: ['100%', '-100%'],
}}
transition={{
duration: 2,
repeat: Infinity,
ease: 'linear',
}}
/>
</Button>
)
}
How to Use
- 1Install Framer Motion:
npm install framer-motion - 2Set up shadcn/ui: Install shadcn/ui components used in this code. Check the imports in the code above and install the required components (e.g.,
npx shadcn-ui@latest add button card) - 3Copy the code from above
- 4Paste it into your project and customize as needed
- 5Colors are customizable via Tailwind CSS classes. The default theme uses dark mode colors defined in your globals.css file