---
title: "Text Sparkles"
description: "Small stars twinkle around a word or a phrase, above and below it, to draw the eye to it."
url: https://gelatinui.com/components/text-sparkles
markdown_url: https://gelatinui.com/components/text-sparkles.md
access: free
install: "npx shadcn@latest add @gelatin-ui/text-sparkles"
registry_item: https://gelatinui.com/r/text-sparkles.json
version: "2026-11-14"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Text Sparkles

> Small stars twinkle around a word or a phrase, above and below it, to draw the eye to it.

Page: https://gelatinui.com/components/text-sparkles

## When to use it

Best for: One short word or phrase that must stand out, such as a plan name or one word of a heading.

- Wrap one key word in a heading, and keep the rest of the heading plain.
- Use `count` (default 6, at most 12) for fewer or more stars; use fewer on small text.
- Use `color` for one data color on every star, such as a brand color. The default uses two item colors.
- Use `paused` to hold the stars from a control of the page.

## When not to use it

- For a sparkle icon on a Generate or an AI button, use [Animated Sparkles Icon](https://gelatinui.com/components/animated-sparkles-icon.md).
- For a light that sweeps across a status line, use [Text Shimmer Wave](https://gelatinui.com/components/text-shimmer-wave.md).
- For a long paragraph, or many words on one page, use plain text: many stars read as noise.

## Notes for agents

- The text stays plain and selectable. The stars are `aria-hidden` and do not take pointer events, so the text reads once.
- Each star twinkles (grows, turns a quarter, and shrinks) at one of three seeded spots, then hops to the next while it is at size 0. A twinkle lasts 1.2s to 2s.
- Spots sit in a band across the top edge or the bottom edge of the text box, in em, also on a text that wraps. Across, they stay inside the text box, so a heading that fills its column does not scroll sideways.
- The motion is CSS loops of `translate`, `scale`, `rotate`, and `opacity`: no JavaScript per frame and no render. The stars stop off screen, in a hidden tab, while `paused` is true, and while a mouse is over it or keyboard focus is on the link or button around it (`pauseOnHover`, default true).
- A paused text still shows stars at several sizes: each star starts at a seeded point of its loop.
- The spots are seeded (`seed`, default from a string text): the server and the browser render the same stars. Star sizes are in em, so they grow with the text.
- The root is `inline-block`, so a long phrase moves to the next line as one piece. An empty text shows no stars.

## Anatomy

```text
TextSparkles
```

## API reference

### TextSparkles

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  | The word or phrase to light up. |
| `paused` | `boolean` |  | The pause of the user or the page (controlled). |
| `defaultPaused` | `boolean` |  | The first pause when `paused` is not given (uncontrolled). Default false. |
| `onPausedChange` | `function` |  | Called when the pause changes. |
| `pauseOnHover` | `boolean` |  | Hold the motion while a mouse is over the item, or keyboard focus is on the link or button around it (or in it). Default true. |
| `count` | `number` | SPARKLES_COUNT.default | How many sparkles. Default 6, at most 12. |
| `color` | `string` |  | One color for every star (a data color, such as a brand color). Default: the two item colors, every other star. |
| `seed` | `number` |  | The seed of the spots, sizes, and pace. Default: from the text, so each text has its own. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| TextSparkles | `text-sparkles` | `data-paused`, `data-tone` | `--motion-ease-sine`, `--sparkles-text-1`, `--sparkles-text-2`, `--sparkles-text-color`, `--sparkles-text-delay`, `--sparkles-text-e1`, `--sparkles-text-e2`, `--sparkles-text-e3`, `--sparkles-text-period`, `--sparkles-text-size`, `--sparkles-text-x1`, `--sparkles-text-x2`, `--sparkles-text-x3`, `--sparkles-text-y1`, `--sparkles-text-y2`, `--sparkles-text-y3` | `motion-timing` |

## Usage

Wrap one key word or a plan name. Keep the rest of the text plain.

The sample also uses `badge`, `button`, which this add does not write. One command adds them with this item:

```bash
npx shadcn@latest add @gelatin-ui/text-sparkles @gelatin-ui/badge @gelatin-ui/button
```

```tsx title="pro-plan-card.tsx"
import { TextSparkles } from "@/components/text/text-sparkles";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";

export function ProPlanCard() {
  return (
    <section className="flex max-w-xs flex-col gap-4 rounded-xl border bg-card p-6">
      <Badge variant="secondary" className="self-start">
        Most popular
      </Badge>
      <h2 className="text-3xl font-bold">
        <TextSparkles count={5}>Pro</TextSparkles>
      </h2>
      <p className="text-sm text-muted-foreground">
        Every component, every template, and updates.
      </p>
      <Button>Get Pro</Button>
    </section>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/text-sparkles
```

It adds 15 registry items: 14 files, 1870 lines, and the npm packages `@mantine/hooks`, `clsx`, `tailwind-merge`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Animated Sparkles Icon](https://gelatinui.com/components/animated-sparkles-icon.md)
- [Text Shimmer Wave](https://gelatinui.com/components/text-shimmer-wave.md)
- [Badge](https://gelatinui.com/components/badge.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Keyboard focus on the link or button around the text holds the stars while `pauseOnHover` is true. |

## Motion

| Part | Motion |
| --- | --- |
| Twinkle | sine · 1.2s to 2s loop · ease (0.45, 0, 0.55, 1) · a star grows from 0, turns a quarter, and shrinks back to 0 |
| Hop | instant · at the end of each twinkle, while the star is at size 0, it moves to its next of three seeded spots |
