# Aurora Text

> Text filled with slowly drifting colour.

- Category: Text effects
- Tier: Free (MIT)
- Page: https://bowls.dev/components/aurora-text
- Requires: React 18+, Tailwind CSS 4

## Install

Copy the source below into `components/bowls/aurora-text.tsx`.

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` | — | The text. |
| `colors` | `string[]` | — | Colours in the sweep. |
| `speed` | `number` | `6` | Seconds for one sweep. |

## Usage

```tsx
import { AuroraText } from "@/components/bowls/aurora-text";

export default function Demo() {
  return (
    <div className="flex h-full w-full items-center justify-center p-6 text-center">
      <h3 className="text-[clamp(34px,4.4vw,52px)] leading-[0.95] font-bold tracking-[-0.045em] text-white dark:text-black">
        Good UI,
        <br />
        <AuroraText>in full colour.</AuroraText>
      </h3>
    </div>
  );
}
```

## Source

`components/bowls/aurora-text.tsx`

```tsx
import type { ReactNode } from "react";

export type AuroraTextProps = {
  children: ReactNode;
  colors?: string[];
  /** Seconds for one sweep of colour. */
  speed?: number;
  className?: string;
};

const DEFAULT_COLORS = ["#ff5c39", "#ffb800", "#22c55e", "#3b82f6", "#a855f7"];

/** Text filled with slowly drifting colour. Still readable: it's just a fill. */
export function AuroraText({ children, colors = DEFAULT_COLORS, speed = 6, className }: AuroraTextProps) {
  const stops = [...colors, colors[0]].join(", ");
  return (
    <span
      className={`inline-block bg-clip-text text-transparent motion-reduce:[animation:none] ${className ?? ""}`}
      style={{
        backgroundImage: `linear-gradient(100deg, ${stops})`,
        backgroundSize: "200% 100%",
        animation: `bowls-aurora ${speed}s linear infinite`,
      }}
    >
      <style href="bowls-aurora" precedence="default">{`@keyframes bowls-aurora{to{background-position:-200% 0}}`}</style>
      {children}
    </span>
  );
}
```
