A visual effect played where the pointer clicks: a ring, a ripple, a crosshair, a burst or particles.
Installation
Usage
<script setup lang="ts">
import { ref } from 'vue';
import { Click } from '@animate-ui/vue/primitives/effects/click';
const area = ref<HTMLElement | null>(null);
</script>
<template>
<div ref="area">
<Click :scope="area" variant="ring">
<p>Click anywhere</p>
</Click>
</div>
</template>Without scope, every click on the page plays the effect.
Animation
- On pointer up, the effect plays centered on the pointer, then is removed. It lasts
duration(400ms by default); withvariant="particles", the dots start one after another and finish a little later. - Effects render in a fixed layer over the page that never catches the pointer, so clicks still reach what's underneath.
- Several clicks in a row each play their own effect.
- Under reduced motion, no effect is played.
API Reference
Click
| Prop | Type | Default |
|---|---|---|
variant? | 'ring' | 'ripple' | 'crosshair' | 'burst' | 'particles' | 'ring' |
color? | string | 'currentColor' |
size? | number | 100 |
duration? | number | 400 |
scope? | HTMLElement | null | - |
disabled? | boolean | false |
#default? | slot | - |
Credits
- Inspired by Framer University.