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

@tasul/shuffle-text-vue

v1.0.0

Published

Vue 3 component and composable for @tasul/shuffle-text

Readme

@tasul/shuffle-text-vue

Vue 3 bindings for @tasul/shuffle-text — a text-switching / morphing effect that cycles an element's text through a list of strings, one character at a time.

Gives you a declarative <ShuffleText> component and a useShuffleText composable for imperative control. The wrapper creates the instance on mount and tears it down on unmount, so you don't manage timers yourself.

ShuffleText demo


Install

npm i @tasul/shuffle-text-vue

vue (^3) is a peer dependency — it uses the one already in your app.

Component (declarative)

The simplest path. Bind a text-array and it renders + animates a container element. Set is-auto to loop automatically.

<script setup lang="ts">
import { ShuffleText } from '@tasul/shuffle-text-vue';

const WORDS = ['Hello', 'Yo!', '¡Hola!', 'Salut', '안녕하세요', 'こんにちは'];
</script>

<template>
  <ShuffleText
    as="h1"
    :text-array="WORDS"
    :is-auto="true"
    :is-replaced-randomly="true"
  />
</template>

Props

Use kebab-case in templates (:text-array, :is-auto, …).

Core options (each is a prop):

| Prop | Type | Default | Description | | :--- | :--- | :--- | :--- | | textArray | string[] | — (required) | Strings to cycle through. Use 2+ for a visible morph. | | isAuto | boolean | false | Start the auto loop on mount. | | isReplacedRandomly | boolean | false | Swap characters in random order instead of left-to-right. | | isDisorderedArray | boolean | false | Shuffle the order of the strings once, on mount. | | stayTime | number | 1500 | Pause (ms) on a finished word before the next (auto loop). | | replaceTime | number | 50 | Time (ms) between each character swap. Lower = faster. |

Container prop (Vue-specific):

| Prop | Type | Default | Description | | :--- | :--- | :--- | :--- | | as | string | 'div' | Which element/tag to render as. |

<ShuffleText as="span" :text-array="WORDS" :is-auto="true" :stay-time="2000" :replace-time="40" />

Each character renders as its own <span>, so you can style the morph with CSS:

.headline :deep(span) { display: inline-block; transition: opacity 0.15s; }

Composable (imperative)

Want to trigger the morph yourself — on click, hover, scroll-into-view? Use the composable. It gives you an elRef to attach to your own element plus the controls.

<script setup lang="ts">
import { useShuffleText } from '@tasul/shuffle-text-vue';

const { elRef, play, playAuto, clear } = useShuffleText({
  textArray: ['Menu', 'Close'],
});
</script>

<template>
  <button @click="play">
    <span ref="elRef" />
  </button>
</template>

What the composable returns

| Field | Type | Description | | :--- | :--- | :--- | | elRef | Ref<HTMLElement \| null> | Attach to the element you want to animate. | | play | () => void | Morph once to the next string. | | playAuto | () => void | Start the auto loop. | | clear | () => void | Stop the loop/timers (also runs automatically on unmount). |

Notes & gotchas

  • Options are read once, on mount. Changing :text-array (or any prop) on an already-mounted component does not restart the morph. To reset it with new options, remount via a changing :key:

    <ShuffleText :key="lang" :text-array="wordsFor(lang)" :is-auto="true" />
  • The component is declarative; the composable is the imperative escape hatch. To call play() / playAuto() / clear() on demand, use useShuffleText — the component does not expose them.

  • SSR (Nuxt / Quasar): the instance is created in onMounted, which only runs client-side, so nothing executes on the server. The morph begins after hydration.

  • textArray needs 2+ entries to morph; a single string just renders once.

License

MIT © tasul