# Lava: API reference

> Every function, option and type Lava exports.

Source: https://cesarvenzac.com/lava/docs/api

## lava

```typescript
function lava(element: HTMLElement, options?: LavaOptions): Lava;

type Lava = {
  readonly element: HTMLElement;
  readonly time: number;     // seconds into its motion
  readonly drawing: boolean; // false while its stand-in shows
  set(options: LavaOptions): void;
  play(): void;
  pause(): void;
  seek(time: number): void;
  destroy(): void;
};
```

## Options

```typescript
type LavaOptions = {
  palette?: PaletteName;       // "amber"
  colours?: Partial<Colours>;
  seed?: string | number;      // "lava"
  speed?: number;              // 1
  count?: number;              // from the box
  size?: number;               // 1
  pool?: number;               // 0.12
  wobble?: number;             // 1
  glow?: number;               // 1
  bloom?: number;              // 1
  gloss?: number;              // 1
  exposure?: number;           // 1
  aperture?: number;           // 1
  focus?: number;              // 0
  haze?: number;               // 1
  grain?: number;              // 1
  label?: string;
  reducedMotion?: boolean;     // the system's
  start?: number;              // 30
  maxPixels?: number;          // 800_000
  paused?: boolean;            // false
};
```

Every number is held to a range it still looks right in.

## Colours

```typescript
type Colours = { wax: string; hot: string; liquid: string; light: string };
type PaletteName = "amber" | "magenta" | "ember" | "acid" | "violet";

const PALETTES: Record<PaletteName, Colours>;
const PALETTE_NAMES: PaletteName[];
function standInOf(colours: Pick<Colours, "liquid" | "light">): string;
```

## React

```typescript
function Lava(props: LavaOptions & HTMLAttributes<HTMLDivElement> & {
  children?: ReactNode;
  handle?: (lamp: Lava | null) => void;
}): JSX.Element;
```

## Lava's docs

- [Overview](https://cesarvenzac.com/lava.md): A lava lamp for any box: thick 3D wax glowing in a dark liquid, shot through a long lens.
- [Getting started](https://cesarvenzac.com/lava/docs/getting-started.md): Install Lava and fill a box with a lava lamp: in React, or in any element, alone or behind content.
- [Colours and light](https://cesarvenzac.com/lava/docs/colours-and-light.md): The five palettes, colours of your own, and the light and lens a lamp is drawn with.
- [Motion and the page](https://cesarvenzac.com/lava/docs/motion-and-the-page.md): How the wax moves, any moment drawn on its own, and how a lamp behaves on a page.
- [API reference](https://cesarvenzac.com/lava/docs/api.md): Every function, option and type Lava exports.
