animated-button
vengenceui/animated-buttonFreeComponent
vengenceui publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by vengenceui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://www.vengenceui.com/r/animated-button.jsonSource
1"use client";23import React from "react";4import { motion, MotionProps } from "framer-motion";5import { cn } from "@/lib/utils";67type AnimatedButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> &8 MotionProps & {9 children?: React.ReactNode;10 as?: any;11 };1213/**14 * AnimatedButton15 * - theme-aware: uses Tailwind `dark:` classes so it works in both light and dark mode16 * - accepts all native button props (onClick, className, type, etc.)17 */18const AnimatedButton: React.FC<AnimatedButtonProps> = ({19 children = "Browse Components",20 className = "",21 as = "button",22 ...rest23}) => {24 const Component = (motion as any)[as] || motion.button;2526 return (27 <Component28 {...rest}29 whileHover={{ scale: 1.01 }}30 whileTap={{ scale: 0.97 }}31 transition={{32 type: "spring",33 stiffness: 500,34 damping: 30,35 mass: 0.5,36 }}37 // Set a CSS variable `--shine` that we override for dark mode via Tailwind.38 className={cn(39 "group inline-flex items-center justify-center px-6 py-2 rounded-md relative overflow-hidden bg-neutral-50 dark:bg-black border border-neutral-200 dark:border-[#222]",40 "text-neutral-900 dark:text-neutral-100 font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-neutral-950 disabled:pointer-events-none disabled:opacity-50",41 "[--shine:rgba(0,0,0,.66)] dark:[--shine:rgba(255,255,255,.66)]",42 className,43 )}44 >45 {/* Text with shine mask */}46 <motion.span47 className="tracking-wide font-light flex items-center justify-center h-full w-full relative z-10"48 style={{49 WebkitMaskImage:50 "linear-gradient(-75deg, white calc(var(--mask-x) + 20%), transparent calc(var(--mask-x) + 30%), white calc(var(--mask-x) + 100%))",51 maskImage:52 "linear-gradient(-75deg, white calc(var(--mask-x) + 20%), transparent calc(var(--mask-x) + 30%), white calc(var(--mask-x) + 100%))",53 }}54 initial={{ ["--mask-x" as any]: "100%" } as any}55 animate={{ ["--mask-x" as any]: "-100%" } as any}56 transition={{57 repeat: Infinity,58 duration: 1,59 ease: "linear",60 repeatDelay: 1,61 }}62 >63 {children}64 </motion.span>6566 {/* Border shine effect uses the --shine variable so it adapts to theme */}67 <motion.span68 className="block absolute inset-0 rounded-md p-px"69 style={{70// … truncated
What it pulls in
npm packages
Files it writes
More from vengenceui
All 128 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | vengenceui | Components | Free | 2 deps | |
| agent-bento-gridagent-bento-grid | vengenceui | Components | Free | 1 dep | |
| alertalert | vengenceui | Components | Free | no deps | |
| animated-footeranimated-footer | vengenceui | Components | Free | 2 deps | |
| animated-numberanimated-number | vengenceui | Components | Free | 1 dep | |
| animated-raysanimated-rays | vengenceui | Components | Free | no deps | |
| animated-tooltipanimated-tooltip | vengenceui | Components | Free | 1 dep | |
| ascii-glitch-rippleascii-glitch-ripple | vengenceui | Components | Free | no deps |
