Skip to content

Sparkles Text

Motion

Headline text with four point stars that twinkle around it in your accent colors. The sparkles are decorative and hidden; the text stays plain and readable.

src/registry/premium/sparkles-text.tsx/r/sparkles-text.json

Installation

bash
npx shadcn@latest add @minidev/sparkles-text

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/sparkles-text.json

Usage

tsx
import { SparklesText } from "@/components/ui/sparkles-text"

export function Example() {
  return (
    <SparklesText />
  )
}

API reference

SparklesText props
PropTypeDefault
childrenThe text that sparkles. Stays a plain text node for search and screen readers.React.ReactNode"Magic, but tasteful"
countHow many stars are alive at once.number8
classNamestring-

When to use

Use it for one short celebratory word or phrase. Reach for GradientText for a still accent and ConfettiButton for a one-off burst on success.

Accessibility

  • Each star is an aria-hidden SVG with pointer-events-none; the text stays a normal text node.
  • It renders a <span>. Wrap it in a heading if the phrase is a heading.
  • Under reduced motion no stars appear.

Frequently asked questions

Does SparklesText keep running off screen?

No. New stars only spawn while the text is in view, one every 420ms, and none spawn under reduced motion. count sets how many are alive at once (default 8).

Why are there no sparkles in the server HTML?

Stars are created with random positions in an effect after mount, so the server renders only the text and hydration matches.

Dependencies

npm

motion

Built from

No other MiniDev files

Examples

Custom text

The text is a normal text node; stars are decorative and hidden from assistive tech.

More stars, smaller text

count is how many stars are alive at once; size the text with className.

Inside a headline

Match the headline's size and weight with className to sparkle one phrase in a longer line.

All Animated React components