Skip to content

Ripple

Material-style press ripple, used by buttons, toggles and tabs.

Installation

bun add @xerobi/ui
import { Ripple } from "@xerobi/ui/ripple"

This component is client-side. In Astro, hydrate it with a client directive.

API reference

Ripple

Material-style press ripple. Render it as a child of any pressable element that is `position: relative`; it listens on that parent and paints a circle that expands from the press point and fades when the press ends. It draws with `currentColor`, so it follows the text colour of the surface. Honours `prefers-reduced-motion` and does nothing on disabled parents.

PropTypeDescription
centerbooleanStart every ripple at the centre instead of the press point, e.g. for icon buttons.
disabledbooleanTurns the effect off while keeping the element mounted.

Styling hooks: [data-slot="ripple"].

Search documentation

Search pages, components and blocks.