Skip to Content
Dashboard and EmbedFramework-Agnostic

Framework-Agnostic

Use @chirpier/embed when you need the hosted Chirpier runtime outside React.

Install

npm install @chirpier/embed

Example

import { mountChirpierChart } from "@chirpier/embed"; const chart = mountChirpierChart("#chart-root", { eventId: "your-event-id", shareToken: "your-share-token", state: { range: "1m", compare: true, view: "timeseries", variant: "bar", }, theme: "dark", autoResize: true, }); // Update state at runtime chart.updateState({ range: "1w", compare: false, view: "summary" }); chart.updateTheme("light"); // Clean up when done chart.destroy();

Options reference

OptionTypeDefaultDescription
eventIdstringRequired. The event definition ID.
shareTokenstringShare token for public access.
stateobjectSee belowChart state configuration.
theme"light" | "dark" | "system""system"Color theme.
autoResizebooleanfalseAuto-resize iframe based on content.
resizeMode"auto" | "fixed" | "fill""auto"How iframe dimensions are managed.
widthnumber | stringFixed width.
heightnumber | stringFixed height.
minHeightnumber | stringMinimum height constraint.
maxHeightnumber | stringMaximum height constraint.
onRendered(event) => voidCalled when the chart finishes rendering.
onResize(event) => voidCalled when the chart resizes.
onError(error) => voidCalled on embed errors.
onInteraction(event) => voidCalled on user interactions.

State defaults

{ range: "1h", aggregate: "sum", variant: "line", compare: false, header: true, view: "all", tracker: { condition: "gt", threshold: 0 }, }

Instance methods

The mountChirpierChart function returns an instance with these methods:

MethodDescription
chart.update(options)Update options including state, theme, and sizing
chart.updateState(state)Update chart state (range, view, variant, etc.)
chart.updateTheme(theme)Switch between light, dark, or system theme
chart.destroy()Remove the iframe and clean up listeners

Good fit

Use this package when:

  • you are embedding in plain JavaScript
  • you want to wrap Chirpier in another frontend framework
  • you need lower-level runtime control over theme and state updates

For chart variant guidance, see Charts.

Last updated on