Lewati ke konten
MarkasUI
Ketik untuk mencari

    Panduan

    MarkasUI

    Form

    Feedback

    Overlay

    Navigasi

    Data

    Section

    Animasi

    Latar

    Tombol

    Template

    Halaman

    Ripple Button

    Tombol yang memancarkan gelombang dari titik klik, atau dari tengah saat ditekan dengan keyboard.

    <div class="flex flex-wrap items-center justify-center gap-3">
        <x-markas.ripple-button>Add to cart</x-markas.ripple-button>
        <x-markas.ripple-button variant="secondary">Save for later</x-markas.ripple-button>
    </div>
    import { RippleButton } from "@/components/markas/RippleButton";
    
    export default function RippleButtonExample() {
      return (
        <div className="flex flex-wrap items-center justify-center gap-3">
          <RippleButton>Add to cart</RippleButton>
          <RippleButton variant="secondary">Save for later</RippleButton>
        </div>
      );
    }
    <script setup lang="ts">
    import RippleButton from "@/components/markas/RippleButton.vue";
    </script>
    
    <template>
      <div class="flex flex-wrap items-center justify-center gap-3">
        <RippleButton>Add to cart</RippleButton>
        <RippleButton variant="secondary">Save for later</RippleButton>
      </div>
    </template>
    <script lang="ts">
      import RippleButton from "$lib/components/markas/RippleButton.svelte";
    </script>
    
    <div class="flex flex-wrap items-center justify-center gap-3">
      <RippleButton>Add to cart</RippleButton>
      <RippleButton variant="secondary">Save for later</RippleButton>
    </div>
    ---
    import RippleButton from "@/components/markas/RippleButton.astro";
    ---
    
    <div class="flex flex-wrap items-center justify-center gap-3">
      <RippleButton>Add to cart</RippleButton>
      <RippleButton variant="secondary">Save for later</RippleButton>
    </div>
    import { Component } from "@angular/core";
    import { RippleButton } from "./markas/ripple-button.component";
    
    @Component({
      selector: "markas-example",
      imports: [RippleButton],
      template: `
        <div class="flex flex-wrap items-center justify-center gap-3">
          <button markas-ripple-button>Add to cart</button>
          <button markas-ripple-button variant="secondary">Save for later</button>
        </div>
      `,
    })
    export default class RippleButtonExample {}

    Contoh

    Varian

    Ukuran

    Form newsletter

    Get the changelog

    One email a month with new components. No spam.

    Get the changelog

    One email a month with new components. No spam.

    Get the changelog

    One email a month with new components. No spam.

    Get the changelog

    One email a month with new components. No spam.

    Get the changelog

    One email a month with new components. No spam.

    Instalasi

    npx markasui@latest add ripple-button

    Pemakaian

    <x-markas.ripple-button>Tambah ke keranjang</x-markas.ripple-button>
    <x-markas.ripple-button variant="secondary" type="submit">Berlangganan</x-markas.ripple-button>
    import { RippleButton } from "@/components/markas/RippleButton";
    
    <RippleButton onClick={addToCart}>Tambah ke keranjang</RippleButton>
    <RippleButton variant="secondary" type="submit">Berlangganan</RippleButton>
    <script setup lang="ts">
    import RippleButton from "@/components/markas/RippleButton.vue";
    </script>
    
    <template>
      <RippleButton @click="addToCart">Tambah ke keranjang</RippleButton>
      <RippleButton variant="secondary" type="submit">Berlangganan</RippleButton>
    </template>
    <script lang="ts">
      import RippleButton from "$lib/components/markas/RippleButton.svelte";
    </script>
    
    <RippleButton onclick={addToCart}>Tambah ke keranjang</RippleButton>
    <RippleButton variant="secondary" type="submit">Berlangganan</RippleButton>
    ---
    import RippleButton from "@/components/markas/RippleButton.astro";
    ---
    
    <RippleButton>Tambah ke keranjang</RippleButton>
    <RippleButton variant="secondary" type="submit">Berlangganan</RippleButton>
    import { Component } from "@angular/core";
    import { RippleButton } from "./markas/ripple-button.component";
    
    @Component({
      selector: "app-cart",
      imports: [RippleButton],
      template: `
        <button markas-ripple-button (click)="addToCart()">
          Tambah ke keranjang
        </button>
        <button markas-ripple-button variant="secondary" type="submit">
          Berlangganan
        </button>
      `,
    })
    export class Cart {
      addToCart() {}
    }

    Angular memakai attribute selector pada button native, jadi disabled, aria-*, dan class tetap di button itu.

    • Klik mouse atau sentuhan memulai gelombang di titik pointer. Enter dan Spasi memulainya dari tengah.
    • Gelombang memakai warna teks dengan opasitas rendah, jadi setiap varian mendapat gelombang yang serasi.
    • Blade butuh Alpine.js.

    Props

    NamaTipeDefaultKeterangan
    variant'primary' | 'secondary' | 'ghost' | 'danger'primaryGaya visual, sama seperti Button.
    size'sm' | 'md' | 'lg'mdTinggi 32, 40, atau 48px, sama seperti Button.
    type'button' | 'submit' | 'reset'buttonAtribut type native.

    Aksesibilitas

    • Elemen button native, jadi Enter dan Spasi berfungsi dan fokus tampil sebagai outline 2px warna primary.
    • Gelombang berada di lapisan aria-hidden dan dihapus setelah selesai.
    • Dengan prefers-reduced-motion tidak ada gelombang, klik tetap berfungsi.

    Komponen terkait

    Komponen tombol lain dengan class yang sama di setiap framework.