Shiny Button
more-shadcn-noair/shiny-buttonFreeComponent
A button with a shiny reflection effect.
Live preview
live · rendered by the registry
Rendered by more-shadcn-noair on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://more-shadcn.noair.fun/r/shiny-button.jsonSource
1<script lang="ts">2 import { cn } from '$UTILS$';3 import { buttonVariants } from '$lib/components/ui/button';4 import type { Snippet } from 'svelte';5 import type { VariantProps } from 'class-variance-authority';6 import type { HTMLButtonAttributes, HTMLAnchorAttributes } from 'svelte/elements';78 type Props = (HTMLButtonAttributes & HTMLAnchorAttributes) &9 VariantProps<typeof buttonVariants> & {10 children: Snippet;11 };1213 let {14 class: className,15 variant = 'default',16 size = 'default',17 href = undefined,18 children,19 ...rest20 }: Props = $props();21</script>2223{#snippet ButtonContent()}24 <div25 class="shine-element absolute inset-0 -top-[20%] -bottom-[20%] z-0 hidden w-[50%] -translate-x-[200%] skew-x-[-20deg] bg-gradient-to-r from-transparent via-current to-transparent opacity-30 group-hover:animate-none md:block"26 aria-hidden="true"27 ></div>2829 <span class="relative z-10 flex items-center justify-center">30 {@render children()}31 </span>32{/snippet}3334{#if href}35 <a36 class={cn(37 'relative overflow-hidden group cursor-pointer',38 buttonVariants({ variant, size }),39 className40 )}41 {href}42 {...rest}43 >44 {@render ButtonContent()}45 </a>46{:else}47 <button48 class={cn(49 'relative overflow-hidden group cursor-pointer',50 buttonVariants({ variant, size }),51 className52 )}53 {...rest}54 >55 {@render ButtonContent()}56 </button>57{/if}5859<style>60 .shine-element {61 animation: shine 4s ease-in-out infinite;62 }6364 @keyframes shine {65 0% {66 left: -100%;67 }68 15% {69 left: 210%;70 }71 100% {72 left: 210%;73 }74 }75</style>
What it pulls in
Other registry items
More from more-shadcn-noair
All 43 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Audioaudio | more-shadcn-noair | Components | Free | no deps | |
| Audio Waveaudio-wave | more-shadcn-noair | Components | Free | no deps | |
| Autocompleteautocomplete | more-shadcn-noair | Components | Free | no deps | |
| Bannerbanner | more-shadcn-noair | Components | Free | no deps | |
| Big Calendarbig-calendar | more-shadcn-noair | Components | Free | no deps | |
| Bottom Navigationbottom-nav | more-shadcn-noair | Components | Free | no deps | |
| Canvascanvas | more-shadcn-noair | Components | Free | no deps | |
| Chipchip | more-shadcn-noair | Components | Free | no deps |
