ClickEffect/ useClickEffect

Listens for click events and spawns the effect at the click position. The simplest Effect — no action-specific options.

16px
250ms
import { useClickEffect } from '@onomatope/react'

function MyComponent() {
  const ref = useClickEffect<HTMLButtonElement>({
    texts: ['POP!', 'click!'],
    color: '#4a4a4a',
  })
  return <button ref={ref}>Click</button>
}

Options

OptionTypeDefaultDescription
textsstring[]["POP!"]Text to display (random pick)
tone"static" | "pop" | "drift" | "rush" | "drop""pop"Animation style
colorstring"#666666"Text color
sizenumbertone defaultFont size in px
durationnumbertone defaultAnimation duration in ms