Kinetic UI
Back to Introduction
Text Effects

Sparkles Text

Delightful SVG sparkles that dynamically generate and animate around your text.

Quick Actions
CLI Installation
npx kinetic-ui-cli@latest add sparkles-text
Sparkles Text

Ship your ideas with Magic

Add that extra bit of delight to your typography with dynamic, physics-based SVG sparkles.

Installation

npx kinetic-ui-cli@latest add sparkles-text

How It Works

The SparklesText component uses React state and intervals to continuously generate random SVG "star" paths around a bounding box. framer-motion's AnimatePresence handles the smooth pop-in and fade-out animations of each sparkle individually.

Usage Guide

1. Import the Component

Import the component into your React or Next.js page:

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

2. Implementation Example

Render the component and customize its behavior by passing props:

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

export default function Example() {
  return (
    <div className="w-full flex items-center justify-center p-8">
      <SparklesText
        text="example"
        colors="example"
      />
    </div>
  );
}
Performance Notes
  • Uses CSS hardware acceleration via GPU transform-binds.
  • Damped interpolation minimizes paint-redraw flashes.
  • Tree-shakable import: only compiles elements requested.
Accessibility Notes
  • Full keyboard focus-ring navigation support (`Tab`/`Shift+Tab`).
  • ARIA roles mapped correctly for assistive screen readers.
  • Respects `prefers-reduced-motion` system toggles.