Shimmer Button
Install: npx shadcn@latest add https://jiguang132.com/r/magic-ui/shimmer-button.json
Use case
Render a native button with a shimmering border.
Native props used by the examples
Extracted from all local examples for this entry, grouped by imported module and native owner, including other Magic components used by compound demos. This is not an exhaustive API or a universal host variant. Inspect spread object declarations and the source types/defaults below.
| Owning component prop | Explanation | Example source |
|---|---|---|
ShimmerButton.className (shimmer-button) | Classes on this native component; initialize Tailwind and its required CSS first. | examples/shimmer-button-demo.tsx |
ShimmerButton.children (shimmer-button) | Native child content; keep the owning component's text/element constraints. | examples/shimmer-button-demo.tsx |
Interaction and state checks
- Shimmer Button Demo —
shimmer-button-demo
These names identify real example entries, not new component props or extra components. Check pointer/keyboard behavior, themes, small screens and failures for the selected example. Decorative effects must not invent disabled/error/submission states. Complete example installation includes the actual dependency closure.
Business integration boundary
Provide the actual onClick/form behavior and accessible name. shimmerDuration is a CSS time string, not a numeric Motion duration.
Host and motion setup
Initialize Tailwind CSS v4, semantic CSS variables and the dark variant; import the independent local Registry namespace. Reuse an existing next-themes Provider without substituting JGuang UI/Base UI/HeroUI APIs. Mount effects in view and unmount offscreen; provide static alternatives for unavailable Canvas/WebGL or failed remote media. Respect prefers-reduced-motion and verify timer/RAF/observer/listener cleanup: stopping CSS alone does not prove the engine stopped. Examples provide no backend, login, payment or real AI stream. This practical guide is bilingual; detailed upstream references and demo text retain their original language.
Available examples
shimmer-button-demo
Demo state and mock data do not provide a backend service. Inspect the component props before wiring real data.
Installation
<Tabs defaultValue="cli"> <TabsList> <TabsTrigger value="cli">CLI</TabsTrigger> <TabsTrigger value="manual">Manual</TabsTrigger> </TabsList> <TabsContent value="cli">npx shadcn@latest add @magicui/shimmer-button
</TabsContent>
<TabsContent value="manual">
<Steps>
<Step>Copy and paste the following code into your project.</Step>
<Step>Update the import paths to match your project setup.</Step>
<Step>Add the required CSS animations</Step>
Add the following animations to your global CSS file.
@theme inline {
--animate-shimmer-slide: shimmer-slide var(--speed) ease-in-out infinite
alternate;
--animate-spin-around: spin-around calc(var(--speed) * 2) infinite linear;
@keyframes shimmer-slide {
to {
transform: translate(calc(100cqw - 100%), 0);
}
}
@keyframes spin-around {
0% {
transform: translateZ(0) rotate(0);
}
15%,
35% {
transform: translateZ(0) rotate(90deg);
}
65%,
85% {
transform: translateZ(0) rotate(270deg);
}
100% {
transform: translateZ(0) rotate(360deg);
}
}
}
</Steps>
</TabsContent>
</Tabs>
Usage
import { ShimmerButton } from "@/components/ui/shimmer-button"
<ShimmerButton>Shimmer Button</ShimmerButton>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
shimmerColor | string | #ffffff | The color of the shimmer |
shimmerSize | string | 0.05em | The size of the shimmer |
borderRadius | string | 100px | The border radius of the button |
shimmerDuration | string | 3s | The duration of the spark animation |
background | string | rgba(0, 0, 0, 1) | The background of the button |
className | string | undefined | The class name of the button |
children | React.ReactNode | undefined | The children of the button |
Credits
Credit to @jh3yy for the inspiration behind this component.
Complete example installation
The component command installs the component. Each example command also includes its actual imported components, native support UI, utilities and pinned dependencies. Helpers are not additional catalog components.
Shimmer Button Demo
npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/shimmer-button/shimmer-button-demo.json
Default import: @/components/magicui/examples/shimmer-button-demo
Dependencies: clsx@2.1.1, tailwind-merge@3.6.0
Minimal usage and theme
import Demo from '@/components/magicui/examples/shimmer-button-demo';
import { ThemeProvider } from 'next-themes';
export default function Example() {
return <ThemeProvider attribute="class" defaultTheme="system" enableSystem><Demo /></ThemeProvider>;
}
Initialize Tailwind CSS v4, semantic color variables and the dark variant first. Reuse an existing next-themes provider rather than nesting another. Next Link examples require a Next.js environment; in static Vite projects adapt the demo links to your router without changing the native component API. Some media and tweets require network access. Examples do not supply authentication or backend services.
Source-backed parameter reference
Implementation signatures and types are generated from the pinned local source. Optional props, native inherited types, union branches and never exclusions are preserved. A forwardRef implementation's ref is a React reference, not an additional business prop.
ShimmerButton({
shimmerColor = "#ffffff",
shimmerSize = "0.05em",
shimmerDuration = "3s",
borderRadius = "100px",
background = "rgba(0, 0, 0, 1)",
className,
children,
...props
}, ref)
export interface ShimmerButtonProps extends ComponentPropsWithoutRef<"button"> {
shimmerColor?: string
shimmerSize?: string
borderRadius?: string
shimmerDuration?: string
background?: string
className?: string
children?: React.ReactNode
}
Destructuring defaults in source
Only defaults written directly in parameter/props destructuring are listed. Conditional expressions, runtime theme and computed values require source inspection; this is not an exhaustive behavior-default list.
// ShimmerButton
shimmerColor = "#ffffff"
// ShimmerButton
shimmerSize = "0.05em"
// ShimmerButton
shimmerDuration = "3s"
// ShimmerButton
borderRadius = "100px"
// ShimmerButton
background = "rgba(0, 0, 0, 1)"
Native and external types
External types remain defined by React or native dependencies, not manually expanded into guessed props. The installed version's TypeScript definitions are authoritative.
HTMLButtonElement
ComponentPropsWithoutRef<"button">
React.ReactNode