Framework-Agnostic Usage
Use @chirpier/embed when you want to mount a chart outside React.
import { mountChirpierChart } from "@chirpier/embed";
const chart = mountChirpierChart("#chart-root", {
eventId: "your-event-id",
autoResize: true,
state: {
view: "timeseries",
variant: "bar",
range: "1m",
compare: true,
},
});
chart.updateState({ range: "1w", view: "summary" });
chart.updateTheme("light");This is the better fit for vanilla JS, Web Components, or wrappers built for other frameworks.
mountChirpierChart() accepts:
eventId: required hosted event identifiershareToken: optional share-scoped access tokenstate: chart/view configurationwidth,height,minHeight,maxHeight,aspectRatio: sizing controlsautoResizeorresizeMode:auto,fixed, orfilltheme:light,dark, orsystembaseUrl: optional override for the hosted Chirpier originclassNameandstyle: iframe styling hooksonRendered,onResize,onError,onInteraction: lifecycle hooks
The returned instance exposes iframe, update(), updateState(), updateTheme(), and destroy().
For multiple embeds, prefer resolving eventId and shareToken from a single server-side CHIRPIER_EMBEDS_JSON value rather than scattering many independent env vars.
Last updated on