marquee
delta-components/marqueeFreeComponent
delta-components publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by delta-components on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://deltacomponents.dev/r/marquee.jsonSource
1"use client"23import type React from "react"4import { useRef, type RefObject } from "react"5import {6 motion,7 useAnimationFrame,8 useMotionValue,9 useScroll,10 useSpring,11 useTransform,12 useVelocity,13 type SpringOptions,14} from "motion/react"1516import { cn } from "@/lib/utils"1718// Custom wrap function for seamless looping19const wrap = (min: number, max: number, value: number): number => {20 const range = max - min21 return ((((value - min) % range) + range) % range) + min22}2324export interface MarqueeProps {25 children: React.ReactNode26 className?: string27 /**28 * Direction of the marquee animation29 * @default "right"30 */31 direction?: "left" | "right" | "up" | "down"32 /**33 * Speed preset for the marquee animation34 * @default "default"35 */36 speedPreset?: "slow" | "default" | "fast"37 /**38 * Speed of the marquee animation (lower is slower, higher is faster)39 * @default 1040 */41 speed?: number42 /**43 * Whether to pause animation on hover44 * @default false45 */46 pauseOnHover?: boolean47 /**48 * Whether to slow down the animation on hover49 * @default false50 */51 slowdownOnHover?: boolean52 /**53 * The factor to slow down the animation on hover54 * @default 0.355 */56 slowDownFactor?: number57 /**58 * The spring config for the slow down animation59 */60 slowDownSpringConfig?: SpringOptions61 /**62 * Whether to show fade effect on edges63 * @default false64 */65 showFade?: boolean66 /**67 * Fade intensity (0-100)68 * @default 12.569 */70 fadeIntensity?: number71 /**72 * Number of times to repeat the children73 * @default 374 */75 repeat?: number76 /**77 * Whether to use the scroll velocity to control the marquee speed78 * @default false79 */80 useScrollVelocity?: boolean81 /**82 * Whether to adjust the direction based on the scroll direction83 * @default false84 */85 scrollAwareDirection?: boolean86 /**87 * The spring config for the scroll velocity-based direction adjustment88 */89 scrollSpringConfig?: SpringOptions90 /**91 * The container to use for the scroll velocity92 */93 scrollContainer?: RefObject<HTMLElement | null> | HTMLElement | null94 /**95 * Whether to allow dragging of the marquee96 * @default false97 */98 draggable?: boolean99 /**100 * The sensitivity of the drag movement101 * @default 0.2102 */103 dragSensitivity?: number104 /**105 * The decay of the drag velocity106 * @default 0.96107 */108 dragVelocityDecay?: number109 /**110// … truncated
Files it writes
More from delta-components
All 93 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| admonitionadmonition | delta-components | Components | Free | 1 dep | |
| cambio-imagecambio-image | delta-components | Components | Free | 2 deps | |
| card-deckcard-deck | delta-components | Components | Free | 3 deps | |
| chatchat | delta-components | Components | Free | 3 deps | |
| code-blockcode-block | delta-components | Components | Free | 3 deps | |
| code-block-iconscode-block-icons | delta-components | Components | Free | no deps | |
| copy-buttoncopy-button | delta-components | Components | Free | 1 dep | |
| input-otpinput-otp | delta-components | Components | Free | 1 dep |
