Cómo funciona
The rim is a 1px transparent border that shows a conic gradient beneath the solid body. A registered angle property turns that gradient, so a single point of light, warm-tinted at its tail, travels around the pill without any oversized spinning element. A blurred copy of the same light glows just outside, and a radial light pools inside along the bottom edge. Hover lifts the button by 1px, brightens the pool and halo and nudges the arrow; pressing settles it to 97.5%.
Úsalo para
- The single most important action of a landing page or hero, such as starting a trial.
- An upgrade or launch moment that deserves a little ceremony.
Busca otra opción cuando
- More than one per screen: the motion stops meaning anything.
- Routine actions in forms or dense interfaces: use a plain button.
Uso
import { ShimmerButton } from './ShimmerButton.jsx'
export function Hero() {
return (
<ShimmerButton size="lg" tone="ink" speed={3.2} href="/signup">
Start free trial
</ShimmerButton>
)
}Propiedades
| Propiedad | Tipo | Por defecto | Qué hace |
|---|---|---|---|
children | ReactNode | — | The label. |
href | string | — | Renders a link instead of a button. |
tone | 'ink' | 'accent' | 'teal' | 'ink' | Body colour and light tint. |
size | 'sm' | 'md' | 'lg' | 'md' | Height 36, 44 or 52px. |
speed | number | 3.2 | Seconds per lap of the light (minimum 0.8). |
glow | boolean | true | Shows the blurred halo outside the rim. |
icon | ReactNode | — | Replaces the trailing arrow; trailing={false} removes it. |
disabled | boolean | false | Disables it and stops the light. |
Accesibilidad
- A native button, or a link when href is given; Enter and Space work as usual, and a disabled link gets aria-disabled.
- The arrow is decorative and hidden from screen readers; the label is the accessible name.
- Focus-visible shows a solid 2px ring outside a gap in the surface colour, clear on both themes.
- White text on the dark or accent body stays above 4.5:1; forced-colors mode shows a plain bordered button.
- Reduced motion parks the light at the top-right corner and removes the lift, press scale and arrow nudge.
Movimiento
The light laps the rim linearly every 3.2s (adjustable), which reads as a steady orbit rather than a pulse. Hover eases in over 240ms (ease-out); the arrow nudges 3px with a spring; pressing scales to 97.5% in 100ms.
Añádelo a tu proyecto
Los miembros Pro copian un prompt y su agente de programación instala el código, igual que con los gratuitos.
ShimmerButton.jsxshimmer-button.csstokens.cssREADME.md
Los dos archivos se instalan juntos. La hoja de estilos lee las variables de tokens.css y lleva valores de reserva, así que también funciona sola.





