Tombol dengan kilau lembut yang melintas berulang. Animasi berhenti saat di luar layar dan saat reduced motion aktif.
<div class="flex justify-center">
<x-markas.shimmer-button size="lg">Get started for free</x-markas.shimmer-button>
</div>import { ShimmerButton } from "@/components/markas/ShimmerButton";
export default function ShimmerButtonExample() {
return (
<div className="flex justify-center">
<ShimmerButton size="lg">Get started for free</ShimmerButton>
</div>
);
}<script setup lang="ts">
import ShimmerButton from "@/components/markas/ShimmerButton.vue";
</script>
<template>
<div class="flex justify-center">
<ShimmerButton size="lg">Get started for free</ShimmerButton>
</div>
</template><script lang="ts">
import ShimmerButton from "$lib/components/markas/ShimmerButton.svelte";
</script>
<div class="flex justify-center">
<ShimmerButton size="lg">Get started for free</ShimmerButton>
</div>---
import ShimmerButton from "@/components/markas/ShimmerButton.astro";
---
<div class="flex justify-center">
<ShimmerButton size="lg">Get started for free</ShimmerButton>
</div>Contoh
Varian
<div class="flex flex-wrap items-center justify-center gap-3">
<x-markas.shimmer-button>Upgrade</x-markas.shimmer-button>
<x-markas.shimmer-button variant="secondary">Book a demo</x-markas.shimmer-button>
<x-markas.shimmer-button variant="ghost">What is new</x-markas.shimmer-button>
<x-markas.shimmer-button variant="danger">Go live</x-markas.shimmer-button>
</div>import { ShimmerButton } from "@/components/markas/ShimmerButton";
export default function Example() {
return (
<div className="flex flex-wrap items-center justify-center gap-3">
<ShimmerButton>Upgrade</ShimmerButton>
<ShimmerButton variant="secondary">Book a demo</ShimmerButton>
<ShimmerButton variant="ghost">What is new</ShimmerButton>
<ShimmerButton variant="danger">Go live</ShimmerButton>
</div>
);
}<script setup lang="ts">
import ShimmerButton from "@/components/markas/ShimmerButton.vue";
</script>
<template>
<div class="flex flex-wrap items-center justify-center gap-3">
<ShimmerButton>Upgrade</ShimmerButton>
<ShimmerButton variant="secondary">Book a demo</ShimmerButton>
<ShimmerButton variant="ghost">What is new</ShimmerButton>
<ShimmerButton variant="danger">Go live</ShimmerButton>
</div>
</template><script lang="ts">
import ShimmerButton from "$lib/components/markas/ShimmerButton.svelte";
</script>
<div class="flex flex-wrap items-center justify-center gap-3">
<ShimmerButton>Upgrade</ShimmerButton>
<ShimmerButton variant="secondary">Book a demo</ShimmerButton>
<ShimmerButton variant="ghost">What is new</ShimmerButton>
<ShimmerButton variant="danger">Go live</ShimmerButton>
</div>---
import ShimmerButton from "@/components/markas/ShimmerButton.astro";
---
<div class="flex flex-wrap items-center justify-center gap-3">
<ShimmerButton>Upgrade</ShimmerButton>
<ShimmerButton variant="secondary">Book a demo</ShimmerButton>
<ShimmerButton variant="ghost">What is new</ShimmerButton>
<ShimmerButton variant="danger">Go live</ShimmerButton>
</div>Ajakan di hero
Ship your dashboard this week
Copy the components you need. Own every line of code.
Ship your dashboard this week
Copy the components you need. Own every line of code.
Ship your dashboard this week
Copy the components you need. Own every line of code.
Ship your dashboard this week
Copy the components you need. Own every line of code.
Ship your dashboard this week
Copy the components you need. Own every line of code.
<section class="grid justify-items-center gap-5 rounded-xl border border-line bg-surface px-6 py-10 text-center">
<span class="rounded-full border border-line bg-subtle px-3 py-1 text-xs font-medium text-muted">Version 2.0 is out</span>
<div class="grid gap-2">
<h2 class="text-2xl font-semibold text-ink">Ship your dashboard this week</h2>
<p class="text-sm text-muted">Copy the components you need. Own every line of code.</p>
</div>
<div class="flex flex-wrap justify-center gap-3">
<x-markas.shimmer-button>Start building</x-markas.shimmer-button>
<x-markas.button variant="ghost">Read the docs</x-markas.button>
</div>
</section>Kartu harga
Pro
$24 / month
- Unlimited projects
- Priority support
- Team roles and audit log
Pro
$24 / month
- Unlimited projects
- Priority support
- Team roles and audit log
Pro
$24 / month
- Unlimited projects
- Priority support
- Team roles and audit log
Pro
$24/ month
- Unlimited projects
- Priority support
- Team roles and audit log
Pro
$24 / month
- Unlimited projects
- Priority support
- Team roles and audit log
<div class="mx-auto grid w-full max-w-xs gap-5 rounded-xl border border-line bg-surface p-6">
<div class="grid gap-1">
<p class="text-sm font-medium text-muted">Pro</p>
<p class="text-3xl font-semibold text-ink">$24<span class="text-sm font-normal text-muted"> / month</span></p>
</div>
<ul class="grid gap-2 text-sm text-ink">
<li>Unlimited projects</li>
<li>Priority support</li>
<li>Team roles and audit log</li>
</ul>
<x-markas.shimmer-button class="w-full">Upgrade to Pro</x-markas.shimmer-button>
</div>Instalasi
npx markasui@latest add shimmer-buttonpnpm dlx markasui@latest add shimmer-buttonyarn dlx markasui@latest add shimmer-buttonbunx --bun markasui@latest add shimmer-button- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Pasang dependensi:
npm install alpinejs - Salin source komponen di bawah ini ke
resources/views/components/markas/shimmer-button.blade.php.
- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/components/markas/ShimmerButton.tsx.
- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/components/markas/ShimmerButton.vue.
- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/lib/components/markas/ShimmerButton.svelte.
- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/components/markas/ShimmerButton.astro.
- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/app/markas/shimmer-button.component.ts.
Pemakaian
<x-markas.shimmer-button size="lg">Mulai gratis</x-markas.shimmer-button>
<x-markas.shimmer-button variant="secondary" :duration="3200">Jadwalkan demo</x-markas.shimmer-button>import { ShimmerButton } from "@/components/markas/ShimmerButton";
<ShimmerButton size="lg">Mulai gratis</ShimmerButton>
<ShimmerButton variant="secondary" duration={3200}>Jadwalkan demo</ShimmerButton><script setup lang="ts">
import ShimmerButton from "@/components/markas/ShimmerButton.vue";
</script>
<template>
<ShimmerButton size="lg">Mulai gratis</ShimmerButton>
<ShimmerButton variant="secondary" :duration="3200"
>Jadwalkan demo</ShimmerButton
>
</template><script lang="ts">
import ShimmerButton from "$lib/components/markas/ShimmerButton.svelte";
</script>
<ShimmerButton size="lg">Mulai gratis</ShimmerButton>
<ShimmerButton variant="secondary" duration={3200}>Jadwalkan demo</ShimmerButton
>---
import ShimmerButton from "@/components/markas/ShimmerButton.astro";
---
<ShimmerButton size="lg">Mulai gratis</ShimmerButton>
<ShimmerButton variant="secondary" duration={3200}>Jadwalkan demo</ShimmerButton>import { Component } from "@angular/core";
import { ShimmerButton } from "./markas/shimmer-button.component";
@Component({
selector: "app-hero",
imports: [ShimmerButton],
template: `
<button markas-shimmer-button size="lg">Mulai gratis</button>
<button markas-shimmer-button variant="secondary" [duration]="3200">
Jadwalkan demo
</button>
`,
})
export class Hero {}Angular memakai attribute selector pada button native, jadi disabled, aria-*, dan class tetap di button itu.
- Kilau berjalan dengan Web Animations API, jadi tidak perlu CSS atau keyframes tambahan.
- IntersectionObserver menjeda animasi saat tombol di luar layar. Dengan reduced motion animasi tidak pernah mulai.
- Blade butuh Alpine.js.
Props
| Nama | Tipe | Default | Keterangan |
|---|---|---|---|
variant | 'primary' | 'secondary' | 'ghost' | 'danger' | primary | Gaya visual, sama seperti Button. |
size | 'sm' | 'md' | 'lg' | md | Tinggi 32, 40, atau 48px, sama seperti Button. |
duration | number | 2400 | Lama satu siklus kilau dalam milidetik. |
type | 'button' | 'submit' | 'reset' | button | Atribut type native. |
Aksesibilitas
- Elemen button native, jadi Enter dan Spasi berfungsi dan fokus tampil sebagai outline 2px warna primary.
- Kilau adalah span dekoratif aria-hidden, labelnya teks biasa.
- Dengan prefers-reduced-motion kilau tidak berjalan dan tombol tampak seperti Button biasa.
Komponen terkait
Komponen tombol lain dengan class yang sama di setiap framework.
- Copy ButtonMenyalin teks ke clipboard. Ikon salin berganti jadi tanda centang beranimasi dan live region mengumumkan Copied.
- Flip ButtonTombol yang berputar seperti kartu saat hover dan fokus keyboard untuk menampilkan teks kedua di sisi belakang.
- GitHub Stars ButtonTautan ke repositori GitHub dengan logo GitHub dan jumlah bintang yang berhitung naik saat terlihat. Tanpa fetch.
- Hold ButtonTombol tekan dan tahan untuk aksi berisiko. Isian menunjukkan progres, lepas lebih awal membatalkan, lalu event complete dipicu.
- Ripple ButtonTombol yang memancarkan gelombang dari titik klik, atau dari tengah saat ditekan dengan keyboard.