use-bouncy-text
TypeScript icon, indicating that this package has built-in type declarations

1.1.6 • Public • Published

use-bouncy-text

A React hook to make any text node bOuNcY

example

Installation

npm install use-bouncy-text

Usage

/* Define your bounce styles */
@keyframes bounce {
  60% {
    transform: translate(0px, -2px) scale(1.2);
  }
}

.bouncy-text {
  display: inline-block;
  margin: 0 1px;
  animation: bounce 0.6s infinite ease-in-out;
}
import { useBouncyText } from 'use-bouncy-text';

export function ComponentWithBouncyText() {
  // Define a ref to the text node you want to make bouncy
  const bounceRef = useRef();
  // pass the ref and your CSS class to the hook
  useBouncyText(bounceRef, 'bouncy-text');

  return <div ref={bounceRef}>I'm bouncy teeeeext</div>;
}

Readme

Keywords

none

Package Sidebar

Install

npm i use-bouncy-text

Weekly Downloads

0

Version

1.1.6

License

MIT

Unpacked Size

13.7 kB

Total Files

12

Last publish

Collaborators

  • britg