Button that sends a ripple out from the click point, or from the center when pressed with the 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>Examples
Variants
<div class="flex flex-wrap items-center justify-center gap-3">
<x-markas.ripple-button>Primary</x-markas.ripple-button>
<x-markas.ripple-button variant="secondary">Secondary</x-markas.ripple-button>
<x-markas.ripple-button variant="ghost">Ghost</x-markas.ripple-button>
<x-markas.ripple-button variant="danger">Danger</x-markas.ripple-button>
</div>import { RippleButton } from "@/components/markas/RippleButton";
export default function Example() {
return (
<div className="flex flex-wrap items-center justify-center gap-3">
<RippleButton>Primary</RippleButton>
<RippleButton variant="secondary">Secondary</RippleButton>
<RippleButton variant="ghost">Ghost</RippleButton>
<RippleButton variant="danger">Danger</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>Primary</RippleButton>
<RippleButton variant="secondary">Secondary</RippleButton>
<RippleButton variant="ghost">Ghost</RippleButton>
<RippleButton variant="danger">Danger</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>Primary</RippleButton>
<RippleButton variant="secondary">Secondary</RippleButton>
<RippleButton variant="ghost">Ghost</RippleButton>
<RippleButton variant="danger">Danger</RippleButton>
</div>---
import RippleButton from "@/components/markas/RippleButton.astro";
---
<div class="flex flex-wrap items-center justify-center gap-3">
<RippleButton>Primary</RippleButton>
<RippleButton variant="secondary">Secondary</RippleButton>
<RippleButton variant="ghost">Ghost</RippleButton>
<RippleButton variant="danger">Danger</RippleButton>
</div>Sizes
<div class="flex flex-wrap items-center justify-center gap-3">
<x-markas.ripple-button size="sm">Small</x-markas.ripple-button>
<x-markas.ripple-button>Medium</x-markas.ripple-button>
<x-markas.ripple-button size="lg">Large</x-markas.ripple-button>
</div>import { RippleButton } from "@/components/markas/RippleButton";
export default function Example() {
return (
<div className="flex flex-wrap items-center justify-center gap-3">
<RippleButton size="sm">Small</RippleButton>
<RippleButton>Medium</RippleButton>
<RippleButton size="lg">Large</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 size="sm">Small</RippleButton>
<RippleButton>Medium</RippleButton>
<RippleButton size="lg">Large</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 size="sm">Small</RippleButton>
<RippleButton>Medium</RippleButton>
<RippleButton size="lg">Large</RippleButton>
</div>---
import RippleButton from "@/components/markas/RippleButton.astro";
---
<div class="flex flex-wrap items-center justify-center gap-3">
<RippleButton size="sm">Small</RippleButton>
<RippleButton>Medium</RippleButton>
<RippleButton size="lg">Large</RippleButton>
</div>Newsletter form
<form class="grid gap-3 rounded-xl border border-line bg-surface p-6">
<div class="grid gap-1">
<p class="text-base font-semibold text-ink">Get the changelog</p>
<p class="text-sm text-muted">One email a month with new components. No spam.</p>
</div>
<div class="flex gap-2">
<input type="email" name="email" aria-label="Email address" placeholder="you@company.com" class="h-10 min-w-0 flex-1 rounded-lg border border-line bg-surface px-3 text-sm text-ink placeholder:text-faint" />
<x-markas.ripple-button type="submit">Subscribe</x-markas.ripple-button>
</div>
</form>Installation
npx markasui@latest add ripple-buttonpnpm dlx markasui@latest add ripple-buttonyarn dlx markasui@latest add ripple-buttonbunx --bun markasui@latest add ripple-button- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Install the dependency:
npm install alpinejs - Copy the component source below to
resources/views/components/markas/ripple-button.blade.php.
resources/views/components/markas/ripple-button.blade.php
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/RippleButton.tsx.
src/components/markas/RippleButton.tsx
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/RippleButton.vue.
src/components/markas/RippleButton.vue
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/lib/components/markas/RippleButton.svelte.
src/lib/components/markas/RippleButton.svelte
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/RippleButton.astro.
src/components/markas/RippleButton.astro
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/app/markas/ripple-button.component.ts.
src/app/markas/ripple-button.component.ts
Usage
<x-markas.ripple-button>Add to cart</x-markas.ripple-button>
<x-markas.ripple-button variant="secondary" type="submit">Subscribe</x-markas.ripple-button>import { RippleButton } from "@/components/markas/RippleButton";
<RippleButton onClick={addToCart}>Add to cart</RippleButton>
<RippleButton variant="secondary" type="submit">Subscribe</RippleButton><script setup lang="ts">
import RippleButton from "@/components/markas/RippleButton.vue";
</script>
<template>
<RippleButton @click="addToCart">Add to cart</RippleButton>
<RippleButton variant="secondary" type="submit">Subscribe</RippleButton>
</template><script lang="ts">
import RippleButton from "$lib/components/markas/RippleButton.svelte";
</script>
<RippleButton onclick={addToCart}>Add to cart</RippleButton>
<RippleButton variant="secondary" type="submit">Subscribe</RippleButton>---
import RippleButton from "@/components/markas/RippleButton.astro";
---
<RippleButton>Add to cart</RippleButton>
<RippleButton variant="secondary" type="submit">Subscribe</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()">Add to cart</button>
<button markas-ripple-button variant="secondary" type="submit">
Subscribe
</button>
`,
})
export class Cart {
addToCart() {}
}Angular uses an attribute selector on the native button, so disabled, aria-*, and class stay on the button.
- A mouse or touch click starts the ripple at the pointer. Enter and Space start it from the center.
- The ripple uses the text color at low opacity, so every variant gets a matching wave.
- Blade needs Alpine.js.
Props
| Name | Type | Default | Description |
|---|---|---|---|
variant | 'primary' | 'secondary' | 'ghost' | 'danger' | primary | Visual style, the same set as Button. |
size | 'sm' | 'md' | 'lg' | md | Height 32, 40, or 48px, the same as Button. |
type | 'button' | 'submit' | 'reset' | button | Native type attribute. |
Accessibility
- A native button element, so Enter and Space work and focus shows a 2px primary outline.
- Ripples live in an aria-hidden layer and are removed when they finish.
- With prefers-reduced-motion no ripple is drawn, the click still works.
Related components
More buttons components with the same classes in every framework.
- Copy ButtonCopies a string to the clipboard. The copy icon turns into an animated check mark and a live region says Copied.
- Flip ButtonButton that flips like a card on hover and keyboard focus to reveal a second line on the back.
- GitHub Stars ButtonLink to a GitHub repository with the GitHub mark and a star count that counts up when it scrolls into view. No fetch.
- Hold ButtonPress-and-hold button for risky actions. A fill tracks progress, releasing early cancels, and a complete event fires.
- Shimmer ButtonButton with a soft sheen that sweeps across it on a loop. The loop pauses off screen and stops with reduced motion.