Shimmer button
A dark pill button with a light that travels around its edge and a soft sweep across the label.
Svelte 5 · Version 1.0.0 · Zero extra packages
Live preview
Design decision
Movement draws the eye to one primary action. Use it once per page so it keeps its pull. Original Svelte 5 implementation. No code was copied from the inspiring component.
Inspired by Shimmer Button by @dillionverma on 21st.dev ↗
Source and integration
Use it like a normal button and pass the label as children. All button attributes pass through. The animation stops for reduced motion.
You may copy and adapt this original SaaSCrisp implementation in personal and commercial websites.
ShimmerButton.svelte
<script lang="ts">
import type { Snippet } from 'svelte';
import type { HTMLButtonAttributes } from 'svelte/elements';
let { children, type = 'button', ...rest }: HTMLButtonAttributes & { children: Snippet } = $props();
</script>
<button class="sb" {type} {...rest}>
<span class="sb-inner">{@render children()}</span>
</button>
<style>
.sb {
--_accent: var(--ui-accent, #c8ff3c);
position: relative;
isolation: isolate;
display: inline-flex;
overflow: hidden;
padding: 0;
border: 0;
border-radius: 999px;
background: rgb(255 255 255 / 0.1);
cursor: pointer;
font-family: var(--ui-font, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif);
box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--_accent) 35%, transparent);
transition: transform 0.15s;
}
.sb::before {
content: '';
position: absolute;
top: 50%;
left: 50%;
z-index: -1;
width: 300%;
aspect-ratio: 1;
translate: -50% -50%;
background: conic-gradient(from 0deg, transparent 0 72%, var(--_accent) 88%, transparent 100%);
animation: sb-spin 3.2s linear infinite;
}
.sb-inner {
position: relative;
display: inline-flex;
align-items: center;
gap: 8px;
margin: 1.5px;
padding: 11px 22px;
overflow: hidden;
border-radius: 999px;
background: radial-gradient(120% 140% at 50% 0%, #26262b, #0b0b0d 70%);
box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.1);
color: #fff;
font-size: 14px;
font-weight: 500;
letter-spacing: -0.01em;
transition: background 0.2s;
}
.sb-inner::after {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(110deg, transparent 35%, rgb(255 255 255 / 0.14) 50%, transparent 65%);
translate: -100% 0;
animation: sb-sweep 3.2s ease-in-out infinite;
}
.sb:hover .sb-inner {
background: radial-gradient(120% 140% at 50% 0%, #303036, #111114 70%);
}
.sb:active {
transform: scale(0.98);
}
.sb:focus-visible {
outline: 2px solid var(--_accent);
outline-offset: 3px;
}
.sb:disabled {
opacity: 0.5;
cursor: not-allowed;
}
@keyframes sb-spin {
to {
rotate: 1turn;
}
}
@keyframes sb-sweep {
60%,
100% {
translate: 100% 0;
}
}
@media (prefers-reduced-motion: reduce) {
.sb::before,
.sb-inner::after {
animation: none;
}
}
</style>
Agent prompt
Use the SaaSCrisp UI Library MCP at https://www.saascrisp.com/api/library/mcp. Retrieve shimmer-button version 1.0.0 for svelte with get_ui_asset. Preview: https://www.saascrisp.com/library/shimmer-button. Confirm the project's stack, reuse local primitives and map CSS variables to existing design tokens. Integrate the files and run the project's checks. Report changed files and additional dependencies.