Shimmer Effect
ui-beats/shimmer-effectFreeComponent
The ShimmerEffect component creates a shimmering animation, ideal for loading placeholders or skeleton screens.
Install it
npx shadcn@latest add https://uibeats.com/r/shimmer-effect.jsonSource
1"use client";23import { motion, useReducedMotion } from "motion/react";45interface ShimmerEffectProps {6 width?: string | number;7 height?: string | number;8 borderRadius?: string | number;9 /** Seconds for one sweep. */10 duration?: number;11 className?: string;12}1314/**15 * A loading placeholder with a sweeping highlight.16 *17 * Both colours are derived from `currentColor`, so the placeholder works on a18 * dark surface as well as a light one. The original hardcoded a black base and19 * a white sweep, which disappeared entirely in dark mode.20 */21export function ShimmerEffect({22 width = "100%",23 height = "1rem",24 borderRadius = "0.375rem",25 duration = 1.5,26 className = "",27}: ShimmerEffectProps) {28 const prefersReducedMotion = useReducedMotion();2930 return (31 <div32 style={{ width, height, borderRadius }}33 className={`relative overflow-hidden bg-current/10 ${className}`}34 aria-hidden="true"35 >36 {prefersReducedMotion ? null : (37 <motion.div38 className="size-full"39 style={{40 background:41 "linear-gradient(90deg, transparent 0%, currentColor 50%, transparent 100%)",42 opacity: 0.18,43 }}44 animate={{ x: ["-100%", "100%"] }}45 transition={{ repeat: Infinity, duration, ease: "linear" }}46 />47 )}48 </div>49 );50}5152export default ShimmerEffect;
What it pulls in
npm packages
Files it writes
More from ui-beats
All 26 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Beamanimated-beam | ui-beats | Components | Free | 1 dep | |
| Bouncebounce | ui-beats | Components | Free | 1 dep | |
| Dockdock | ui-beats | Components | Free | 1 dep | |
| Fade Infade-in | ui-beats | Components | Free | 1 dep | |
| Fade In Unblurfade-in-unblur | ui-beats | Components | Free | 1 dep | |
| Flip Cardflip-card | ui-beats | Components | Free | 2 deps | |
| Glowing Cardglowing-card | ui-beats | Components | Free | 1 dep | |
| Gradient Flowgradient-flow | ui-beats | Components | Free | 1 dep |
