# Lottie
## Example
```svelte
```
## Documentation
## Usage
Render a Lottie animation. `lottie-web` is dynamically imported, so it's only downloaded when a `Lottie` component actually mounts.
### From a URL
```svelte
```
### From imported JSON
Import the animation data directly (bundled as its own chunk):
```svelte
```
> **Heads up:** if you need to hold the animation data in reactive state, use `$state.raw` (not `$state`). Lottie JSON is large and nested — Svelte's deep state proxy breaks `structuredClone`, which is used internally for `colorMap` recoloring.
>
> ```svelte
> let anim = $state.raw(animationData);
> ```
Set the size with regular classes — the underlying SVG fills the container.
### Theming colors
Swap any color baked into the Lottie JSON to match your theme. Keys are the source colors in the animation, values are any CSS color — hex, `rgb()`, or `var(--token)`:
```svelte
```
CSS variables are resolved from the document's computed styles at mount.
## API Reference
### Lottie
Renders a Lottie animation. lottie-web is lazy-loaded on mount so it only ships when used.
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| src | `string` | `-` | URL to a Lottie animation JSON file. |
| data | `unknown` | `-` | Parsed animation JSON. Takes precedence over src. |
| loop | `boolean` | `true` | Whether to loop the animation. |
| autoplay | `boolean` | `true` | Whether to start playing on mount. |
| renderer | `'svg' | 'canvas' | 'html'` | `'svg'` | Lottie renderer to use. |
| colorMap | `Record` | `-` | Map of source → target colors. Recolors the animation JSON before rendering. Values can be hex, rgb(), or var(--token). |