Pulsating Button
svelte-animations/pulsating-buttonFreeBlock
A button component with a pulsating ring effect that expands and fades around the button.
Install it
npx shadcn@latest add https://sv-animations.vercel.app/r/pulsating-button.jsonSource
1<script lang="ts">2 import { cn } from "$UTILS$";3 import type { Snippet } from "svelte";45 interface PulsatingButtonProps {6 children: Snippet;7 class?: string;8 pulseColor?: string;9 duration?: string;10 distance?: string;11 variant?: "slow" | "ring" | "ripple";12 }1314 let {15 class: className,16 children,17 pulseColor = "#808080",18 duration = "1.5s",19 distance = "8px",20 variant = "slow",21 ...props22 }: PulsatingButtonProps = $props();23</script>2425<button26 class={cn(27 "bg-primary text-primary-foreground relative flex cursor-pointer items-center justify-center rounded-lg px-4 py-2 text-center",28 className29 )}30 style="--pulse-color: {pulseColor}; --duration: {duration}; --distance: {distance};"31 {...props}32>33 <div class="relative z-10">34 {@render children()}35 </div>36 <span37 aria-hidden="true"38 class={cn(39 "pointer-events-none absolute inset-0 rounded-[inherit] bg-inherit",40 variant === "ripple" && "animate-pulse-ripple",41 variant === "ring" && "animate-pulse-ring",42 variant === "slow" && "animate-pulse-slow"43 )}44 ></span>45</button>
Files it writes
More from Svelte Animations
All 66 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Beamanimated-beam | Svelte Animations | Blocks | Free | 1 dep · 6 files | |
| Animated Circular Progress Baranimated-circular-progress-bar | Svelte Animations | Blocks | Free | no deps · 2 files | |
| Animated Gradient Textanimated-gradient-text | Svelte Animations | Blocks | Free | no deps · 2 files | |
| Animated Grid Patternanimated-grid-pattern | Svelte Animations | Blocks | Free | 1 dep · 2 files | |
| Animated Listanimated-list | Svelte Animations | Blocks | Free | 1 dep · 2 files | |
| Animated Shiny Textanimated-shiny-text | Svelte Animations | Blocks | Free | no deps | |
| Animated Theme Toggleranimated-theme-toggler | Svelte Animations | Blocks | Free | no deps · 2 files | |
| Arc Timelinearc-timeline | Svelte Animations | Blocks | Free | no deps · 3 files |
