Ballmac UI home

Sparkles Text

Text with four-point stars that twinkle around it in theme colors, re-rolling position each time, with an optional gradient fill.

Right-to-left: Sparkles are placed by random percentages from the left edge and centred with a negative margin; decoration with no reading direction.

Meet the new Pro plan

Installation

$ pnpm dlx shadcn@latest add @ballmac/sparkles-text

Usage

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

The full example is in the Code tab above.

Examples

Gradient fill

Level up

You unlocked 3 new badges this week.

API reference

PropTypeDefault
children*

The text to decorate.

React.ReactNode—
count

How many sparkles twinkle at once.

number8
gradient

Show a soft gradient fill on the text itself.

booleanfalse

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Screen readersSparkles are aria-hidden and pointer-events-none; the text is untouched
Reduced motionNo sparkles are drawn

Use with AI

<SparklesText count gradient>Text</SparklesText>. Sparkles are decorative and positioned after mount, so the server markup stays identical. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Sparkles Text (@ballmac/sparkles-text) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • One standout word in a marketing headline
  • Celebratory states such as a new plan or achievement

Not for

  • Dense UI
  • More than one or two per screen

Registry JSON: https://ui.ballmac.com/r/sparkles-text.json

Credits

Free to use in personal and commercial projects.

Registry
shadcn/utils