# FireworksHdr

> GPU fireworks background with a deterministic, DOM-free physics core (rockets, peony/willow/ring/glyph shells, sparks, embers, smoke) rendered by a WebGPU engine into a wide-gamut, extended-tone-mapping canvas so bursts and comet trails burn brighter than SDR white on HDR displays, degrading silently through a WebGL2 fallback and a soft-knee SDR path everywhere else.

- Package: `fancy-ui-react` (React 18/19 + Tailwind CSS v4)
- Category: Effects
- Tags: hdr, webgpu, particles, fireworks, background
- Types: `FireworksHdrProps`, `FireworksHandle`, `LaunchOptions`, `LaunchResult`, `FireworksRenderLevel`, `ShellKind`, `QualityTier`, `Outline`, `BurstDir`, `Vec2`
- Docs: https://fancy-ui.rama.app/docs/components/fireworks-hdr
- Source: https://github.com/RamaHerbin/fancy-ui/tree/main/react/src/components/fireworks-hdr

## Import

```tsx
import { FireworksHdr } 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 |
| --- | --- | --- | --- |
| `palette` | `string[]` | `["#ff2fd6","#a142ff","#3d5bff","#42cfff"]` | Brand hues (hex); order-independent, sorted cool→warm for the shell sweep |
| `hdr` | `boolean` | `true` | Opt into the GPU engine (WebGPU HDR first, then a WebGL2 fallback); when false, no engine boots |
| `exposure` | `number` | `2.2` | Display exposure multiplier, clamped to [1, 4] |
| `ambient` | `boolean` | `true` | Run the ambient auto-scheduler (Poisson-timed background shells) |
| `ambientIntensity` | `number` | `0.35` | Ambient energy [0,1] — scales shell size |
| `interactive` | `boolean` | `true` | Launch a shell toward the pointer on pointerdown |
| `quality` | `"auto" \| "high" \| "mid" \| "low"` | `"auto"` | Particle budget; auto picks from the render level and device pixel ratio |
| `respectReducedMotion` | `boolean` | `true` | Force ambient off under prefers-reduced-motion (explicit launches still work) |
| `className` (Svelte `class`) | `string` | `""` | Extra classes on the canvas wrapper |
| `ambientShells` | `ShellKind[]` | — | Restrict the ambient scheduler to these shells, picked uniformly — including the pattern shells 'heart' and 'star'; defaults to a weighted peony/willow/ring mix ('glyph' and 'shape' are ignored, they need caller-supplied points) |
| `onReady` | `(handle: FireworksHandle) => void` | — | Fired when the engine is live with an imperative handle, and again with a fresh handle after a recovered GPU context loss; never fired when no GPU renderer comes up |
| `onLost` | `() => void` | — | Fired once when a GPU context loss could not be recovered; the component has torn itself down and any handle it gave out is inert |

## 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/fireworks-hdr.md.
