Glow Button
unlumen-ui/glowFreeComponent
A button with an animated conic-gradient glow layer behind it. Supports rotate, pulse, breathe, colorShift, flowHorizontal and static modes.
Install it
npx shadcn@latest add https://ui.unlumen.com/r/glow.jsonSource
1"use client";23import * as React from "react";4import { motion, type Transition } from "motion/react";56import { type VariantProps } from "class-variance-authority";7import { Button, buttonVariants } from "@/components/ui/button";8import { cn } from "@/lib/utils";910type ButtonProps = React.ComponentPropsWithoutRef<"button"> &11 VariantProps<typeof buttonVariants> & { asChild?: boolean };1213type GlowMode =14 | "rotate"15 | "pulse"16 | "breathe"17 | "colorShift"18 | "flowHorizontal"19 | "static";2021type GlowBlur =22 | number23 | "softest"24 | "soft"25 | "medium"26 | "strong"27 | "stronger"28 | "strongest"29 | "none";3031const BLUR_PRESETS: Record<string, string> = {32 softest: "blur-xs",33 soft: "blur-sm",34 medium: "blur-md",35 strong: "blur-lg",36 stronger: "blur-xl",37 strongest: "blur-2xl",38 none: "blur-none",39};4041function blurClass(blur: GlowBlur) {42 if (typeof blur === "number") return `blur-[${blur}px]`;43 return BLUR_PRESETS[blur] ?? "blur-md";44}4546interface GlowEffectInnerProps {47 colors?: string[];48 mode?: GlowMode;49 blur?: GlowBlur;50 scale?: number;51 duration?: number;52 transition?: Transition;53 className?: string;54}5556function GlowEffectLayer({57 colors = ["#FF5733", "#33FF57", "#3357FF", "#F1C40F"],58 mode = "rotate",59 blur = "strong",60 scale = 1,61 duration = 5,62 transition,63 className,64}: GlowEffectInnerProps) {65 const base: Transition = { repeat: Infinity, duration, ease: "linear" };6667 const animations: Record<GlowMode, object> = {68 rotate: {69 background: [70 `conic-gradient(from 0deg at 50% 50%, ${colors.join(", ")})`,71 `conic-gradient(from 360deg at 50% 50%, ${colors.join(", ")})`,72 ],73 transition: transition ?? base,74 },75 pulse: {76 background: colors.map(77 (c) => `radial-gradient(circle at 50% 50%, ${c} 0%, transparent 100%)`,78 ),79 scale: [scale, scale * 1.1, scale],80 opacity: [0.5, 0.8, 0.5],81 transition: transition ?? { ...base, repeatType: "mirror" },82 },83 breathe: {84 background: colors.map(85 (c) => `radial-gradient(circle at 50% 50%, ${c} 0%, transparent 100%)`,86 ),87 scale: [scale, scale * 1.05, scale],88 transition: transition ?? { ...base, repeatType: "mirror" },89 },90 colorShift: {91 background: colors.map((c, i) => {92 const next = colors[(i + 1) % colors.length];93 return `conic-gradient(from 0deg at 50% 50%, ${c} 0%, ${next} 50%, ${c} 100%)`;94 }),95// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from Unlumen Ui
All 233 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| AI Chatai-chat | Unlumen Ui | Components | Paid | 2 deps | |
| Vercel Animate Countanimate-count | Unlumen Ui | Components | Free | 1 dep | |
| Animate Digitsanimate-digits | Unlumen Ui | Components | Free | 1 dep | |
| Animated Inputanimate-text-input-typing | Unlumen Ui | Components | Paid | 1 dep | |
| Animated Listanimated-list | Unlumen Ui | Components | Free | 1 dep | |
| Apple Switchapple-switch | Unlumen Ui | Components | Free | 1 dep | |
| Aurora Barsaurora-bars | Unlumen Ui | Components | Free | 1 dep | |
| Aurora Bluraurora-blur | Unlumen Ui | Components | Free | 2 deps |
