Glin UI
Primitive / AtomAdapted from Magic UIbeta

Sparkles Text

Text with twinkling star sparkles that scale and rotate, with a static accent under reduced motion.

Edit on GitHub

Glin UI Pro

Lifetime access to every template.

Installation

Install from
pnpm dlx @glinui/cli@latest add sparkles-text

Credits. Adapted from Magic UI (MIT, (c) Magic UI). No motion dependency (Web Animations), sparkles generated after mount for SSR safety, token colors and reduced motion levels. Attribution details.

Prefer the package?

Usage

Improvements: no motion dependency (Web Animations API), sparkles are created after mount so there is no hydration mismatch from Math.random, a fixed pool re-rolls position in place instead of replacing DOM every 100ms, positions use logical inline-start so RTL mirrors, and the count is capped.

Engines: the `engine` prop is not applicable. Continuous particle twinkle in css keyframes; no entrance to hand to an engine.

Custom colors and count

Any CSS color works, including tokens.

Shipped
import { SparklesText } from "@glinui/ui"
export function Demo() {
return (
<SparklesText
sparklesCount={16}
colors={{ first: "var(--color-signal-live)", second: "var(--color-accent)" }}
>
Shipped
</SparklesText>
)
}

Accessibility

  • The text is real DOM text and is read normally.
  • Every sparkle is a decorative svg with aria-hidden and is pointer-events none.
  • No flashing: sparkles scale and fade over about one second each.

ARIA Attributes

  • `aria-hidden` on every sparkle

Reduced Motion

With prefers-reduced-motion or motion level none or subtle, the animated pool is replaced by two static stars.

Affected properties

sparkle scalerotationopacity

API Reference

PropTypeRequiredDefaultDescription
childrenReact.ReactNodeYes-The text to decorate. Required.
as"div" | "span" | "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6"NodivElement to render.
sparklesCountnumberNo10Sparkles alive at once. Capped at 24.
colorsSparklesTextColorsNoaccent, signal-ok tokensSparkle colors, any CSS color.

Source

Import directly from the package or browse the source on GitHub. Click any file to view it.

Import

import { SparklesText } from "@glinui/ui"

Dependencies

@glinui/ui@glinui/motion

Generated API Snapshot

Beta

Auto-extracted from TypeScript source in packages/ui/src/components/sparkles-text.tsx. This section is in beta and may lag behind hand-curated docs. Regenerate with pnpm --filter @glinui/docs api:generate.

Generated: 2026-10-08T01:41:21.546Z · Full index: /docs/api-metadata

Primary Props Type

SparklesTextProps

SparklesTextProps

PropTypeRequiredDefaultDescription
as"div" | "span" | "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6"No"div"Element to render.
childrenReact.ReactNodeYes--
colorsSparklesTextColorsNoDEFAULT_COLORSSparkle colors. Any CSS color, defaults to Glin tokens.
sparklesCountnumberNo10Number of sparkles alive at once. Capped at 24.