# MosaicGlow

> Canvas mosaic of small tiles on a dark surface where a soft halo follows the cursor with a lag, lighting tiles to random gold intensities that decay into a comet trail, with an additive bloom over the gaps, a glassy per-tile highlight, ambient flicker and an autonomous drift when idle.

- Package: `fancy-ui-react` (React 18/19 + Tailwind CSS v4)
- Category: Backgrounds
- Tags: canvas, grid, mosaic, glow, cursor, halo, trail, background, interactive
- Types: `MosaicGlowProps`, `MosaicGlowIdle`
- Docs: https://fancy-ui.rama.app/docs/components/mosaic-glow
- Source: https://github.com/RamaHerbin/fancy-ui/tree/main/react/src/components/mosaic-glow

## Import

```tsx
import { MosaicGlow } from 'fancy-ui-react';
```

Setup (once per project): `npm install fancy-ui-react`, then put these lines in your main CSS file (the stylesheet import goes right after `@import "tailwindcss";`):

```css
@import "tailwindcss";
@import "fancy-ui-react/tailwind.css";
```

and import the component styles once in the app entry: `import "fancy-ui-react/styles.css";`. Full guide: https://fancy-ui.rama.app/llms.txt

The names below are the ones to write in React; when one differs from the Svelte name, the Svelte name follows in parentheses. `class` becomes `className`, a callback takes the name the React port declares (`onclick` becomes `onClick`), snippets become `ReactNode` props (render functions when they take arguments) and the default snippet is `children`. Divergences: https://github.com/RamaHerbin/fancy-ui/tree/main/react#divergences-from-the-svelte-api

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `hdr` | `boolean` | `true` | On a display that reports HDR, adds the light above SDR white in a WebGPU layer with extended tone mapping: the hottest tiles peak around 1000 nits and the halo gets a hot core. Elsewhere nothing starts and the mosaic is unchanged |
| `tileSize` | `number` | `18` | Tile edge in CSS px |
| `gap` | `number` | `2` | Gap between tiles in CSS px |
| `color` | `string` | `"#f2c318"` | Halo and tile colour, hex or rgb() |
| `background` | `string` | `"#0a0a0a"` | Surface colour behind the tiles, hex or rgb() |
| `radius` | `number` | `170` | Halo radius in CSS px |
| `intensity` | `number` | `1` | Overall brightness of lit tiles, 0 to 1 |
| `trail` | `number` | `0.6` | How long lit tiles linger after the halo moves on, 0 to 1 |
| `smoothing` | `number` | `0.15` | Pointer lag, 0 (instant) to 1 (very laggy) |
| `noise` | `number` | `0.7` | Spread of per-tile random brightness inside the halo, 0 to 1 |
| `ambient` | `number` | `0.35` | Visibility of the random faint tiles outside the halo, 0 to 1 |
| `flicker` | `boolean` | `true` | Slowly re-roll the faint tiles over time |
| `idle` | `"drift" \| "none"` | `"drift"` | With no pointer for 1.5s: drift wanders the halo on a slow path, none switches it off |
| `interactive` | `boolean` | `true` | Follow the pointer. Off leaves only the idle behaviour |
| `seed` | `number` | `1` | Seed for the per-tile randomness; same seed, same mosaic |
| `ref` | `HTMLDivElement \| null` | `null` | Bindable host element |
| `className` (Svelte `class`) | `string` | — | Additional classes on the host |

## Node props

| Prop | Description |
| --- | --- |
| `children` | Content rendered above the canvas; give the host a height |

## Example

No React example is published for this component yet: start from the import above and the props table. The full examples are Svelte-only, on https://fancy-ui.rama.app/docs/components/mosaic-glow.md.
