npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@scrambl/react

v0.1.1

Published

React hooks and components for @scrambl/core text scramble effects

Readme

@scrambl/react provides a hook and a component for text scramble animations in React. It includes @scrambl/core as a dependency, so you do not need to install the core package separately.

Install

npm install @scrambl/react

useScramble

The hook is the primary API. Attach the returned ref to the element you want to animate.

import { useScramble } from '@scrambl/react'

export function Hero() {
  const { ref, replay, pause, resume, isPlaying } = useScramble({
    text: 'Hello World',
    chars: 'blocks',
    from: 'left',
    duration: 800,
    trigger: 'hover',
    playOnMount: true,
  })

  return (
    <div>
      <h1 ref={ref} />
      <button onClick={replay}>Replay</button>
      <button onClick={pause}>Pause</button>
      <button onClick={resume}>Resume</button>
      <span>{isPlaying ? 'Playing' : 'Idle'}</span>
    </div>
  )
}

Hook Options

useScramble accepts every ScrambleOptions field plus:

| Option | Default | Description | | --- | --- | --- | | trigger | 'manual' | manual, hover, click, or inView | | playOnMount | true | Play immediately when the element mounts | | inViewOptions | { threshold: 0.1 } | IntersectionObserver options for trigger: 'inView' |

Hook Return Value

| Property | Description | | --- | --- | | ref | Callback ref for the target element | | replay() | Restart the animation | | pause() | Pause playback | | resume() | Resume playback | | isPlaying | Whether the animation is currently playing |

ScrambleText

Use the component for straightforward cases.

import { ScrambleText } from '@scrambl/react'

export function App() {
  return (
    <ScrambleText
      as="h1"
      text="Hello World"
      chars="blocks"
      trigger="hover"
      className="title"
    />
  )
}

The component accepts all hook options plus:

| Prop | Default | Description | | --- | --- | --- | | as | 'span' | HTML tag to render | | className | - | CSS class name | | style | - | Inline styles |

Imperative Ref

import { useRef } from 'react'
import { ScrambleText, type ScrambleTextRef } from '@scrambl/react'

export function App() {
  const scrambleRef = useRef<ScrambleTextRef>(null)

  return (
    <>
      <ScrambleText ref={scrambleRef} text="Hello" chars="blocks" />
      <button onClick={() => scrambleRef.current?.replay()}>Replay</button>
    </>
  )
}

Patterns

Scroll Reveal

const { ref } = useScramble({
  text: 'Revealed on scroll',
  chars: 'braille',
  trigger: 'inView',
  playOnMount: false,
  duration: 1200,
  from: 'random',
})

Text Cycling

import { useEffect, useState } from 'react'
import { useScramble } from '@scrambl/react'

const words = ['Developer', 'Designer', 'Creator']

export function CyclingText() {
  const [index, setIndex] = useState(0)
  const { ref, replay } = useScramble({
    text: words[index],
    chars: 'katakana',
    duration: 600,
  })

  useEffect(() => {
    const timer = setInterval(() => {
      setIndex((i) => (i + 1) % words.length)
      replay()
    }, 3000)

    return () => clearInterval(timer)
  }, [replay])

  return <span ref={ref} />
}

Requirements

  • React 18+
  • Modern browsers with requestAnimationFrame
  • TypeScript declarations are included

License

MIT