# Stars

Starfield background that fills a positioned parent with a seeded canvas of sharp and soft stars. Optional twinkle and fade-in respect reduced motion, and a circular cutout can hide stars behind an orb.

Component · Glow · https://01orbital.dev/docs/components/stars

## Installation

```bash
npx shadcn@latest add @01orbital/stars
```

## Usage

```tsx
import { Stars } from "@/components/glow/stars"

export default function StarsDemo({
  animated = false,
}: {
  animated?: boolean
}) {
  return (
    <div
      className="dark relative isolate h-[32rem] w-full shrink-0 overflow-hidden bg-background sm:h-[40rem]"
      data-stars-demo
    >
      <Stars animated={animated} arrival={false} density={4} />
    </div>
  )
}
```

This example installs with everything it uses:

```bash
npx shadcn@latest add @01orbital/stars-demo
```

## API reference

A seeded canvas starfield of near-white stars, some sharp dots and some soft discs, for a dark ground. It fills its positioned parent, redraws when that box resizes, ignores the pointer and is hidden from assistive tech.

`animated` adds a twinkle and a fade-in, both off under reduced motion. `occlude` cuts a circular hole so the stars sit behind an orb.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `animated?` | `boolean` | `false` | false = paint once, zero cost; true = ~45% of stars twinkle (opacity only). |
| `density?` | `number` | `1` | Multiplier on base density (1 star per ~4500 css px²). |
| `seed?` | `number` | `DEFAULT_SEED` | Two fields of the same box size paint identically without this. |
| `softRatio?` | `number` | `0.45` | Share of stars drawn as a soft disc instead of a hard dot. 0 = every star sharp, which is what reads as digital. Costs nothing — same draw pass. |
| `arrival?` | `boolean` | `true` | One 4s fade-in on mount, under the twinkle. Only applies when animated. |
| `occlude?` | `{ x?: string; y?: string; r: string; }` |  | Cut a circular hole so stars read as BEHIND a round object (planet, orb). Any CSS lengths; x/y default center; for a centered orb of size N, r = N/2 px. |

## Dependencies

npm: `cn`

## Examples

- **Footer** (`@01orbital/stars-footer`): Stars example: a dark footer over a seeded starfield with a vignette, a large title and three link columns.
