# Particle Field

> Specks that drift slowly behind your content and scatter from the mouse.

```tsx
import { Button, ParticleField } from '@brand-studio/ui';

export default function ParticleFieldDemo() {
  return (
    <ParticleField style={{ width: '100%', maxWidth: 720, padding: '72px 32px', borderRadius: 20, border: '1px solid var(--bs-line-soft)', textAlign: 'center' }}>
      <p style={{ margin: '0 0 8px', fontSize: 13, color: 'var(--bs-muted)' }}>Night mode, new in firmware 2.1</p>
      <h3 style={{ margin: '0 auto 20px', fontSize: 'clamp(26px, 5vw, 40px)', maxWidth: 460 }}>Shoot by starlight.</h3>
      <Button tone="secondary">See the night samples</Button>
    </ParticleField>
  );
}
```

## Installation

```sh
npm install @brand-studio/ui
```

React 18 or 19 is a peer dependency. Import the stylesheet once and wrap the app in a brand theme:

```tsx
import '@brand-studio/ui/styles.css';
import { BrandTheme, ParticleField } from '@brand-studio/ui';
import brand from './brand.json';

<BrandTheme palette={brand.tokens} mode="system">
  {/* your app */}
</BrandTheme>
```

## Usage

```tsx
import { ParticleField } from '@brand-studio/ui';
```

```tsx
<ParticleField count={80}>
  <h2>Shoot by starlight.</h2>
</ParticleField>
```

Specks take the ink colour, and one in five the accent. Keep `count` under about 150 on a large section.

## Accessibility

- The specks are drawn on a canvas hidden from screen readers; your content sits above it.
- It pauses off screen, and reduced motion holds one still frame.

## API Reference

| Prop | Type | Default |
|---|---|---|
| `count?` | `number` | `80` |

Source: https://brandstudio.js.org/docs/components/particle-field/
