Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

2.4 KB
Raw Blame
---
title: Aurora Text
date: 2025-01-12
description: A beautiful aurora text effect
author: Dillon
published: true
---

<ComponentPreview name="aurora-text-demo" />

## Installation

<Tabs defaultValue="cli">

<TabsList>
  <TabsTrigger value="cli">CLI</TabsTrigger>
  <TabsTrigger value="manual">Manual</TabsTrigger>
</TabsList>
<TabsContent value="cli">

```bash
npx shadcn@latest add @magicui/aurora-text
```

</TabsContent>

<TabsContent value="manual">

<Steps>

<Step>Copy and paste the following code into your project.</Step>

<ComponentSource name="aurora-text" />

<Step>Update the import paths to match your project setup.</Step>

<Step>Add the required CSS animations</Step>

Add the following animations to your global CSS file.

```css title="app/globals.css" showLineNumbers {2, 4-25}
@theme inline {
  --animate-aurora: aurora 8s ease-in-out infinite alternate;

  @keyframes aurora {
    0% {
      background-position: 0% 50%;
      transform: rotate(-5deg) scale(0.9);
    }
    25% {
      background-position: 50% 100%;
      transform: rotate(5deg) scale(1.1);
    }
    50% {
      background-position: 100% 50%;
      transform: rotate(-3deg) scale(0.95);
    }
    75% {
      background-position: 50% 0%;
      transform: rotate(3deg) scale(1.05);
    }
    100% {
      background-position: 0% 50%;
      transform: rotate(-5deg) scale(0.9);
    }
  }
}
```

</Steps>

</TabsContent>

</Tabs>

## Usage

```tsx showLineNumbers
import { AuroraText } from "@/components/ui/aurora-text"
```

```tsx showLineNumbers
<AuroraText>Aurora Text</AuroraText>
```

## Props

| Prop        | Type        | Default                                         | Description                                                   |
| ----------- | ----------- | ----------------------------------------------- | ------------------------------------------------------------- |
| `className` | `string`    | `""`                                            | The class name to be applied to the component                 |
| `children`  | `ReactNode` | `-`                                             | Children elements                                             |
| `colors`    | `string[]`  | ` ["#FF0080", "#7928CA", "#0070F3", "#38bdf8"]` | Array of colors used for the aurora effect                    |
| `speed`     | `number`    | `1`                                             | Animation speed multiplier (1 is default, 2 is twice as fast) |