--- url: https://chartbuddy.io/embed/docs/guides/react.md --- > Docs index: [llms.txt](https://chartbuddy.io/embed/docs/llms.txt) # React ```bash npm install @chartbuddy.io/embed react ``` `react` is an optional peer dependency — install it only if you use these bindings. React 18 or 19. ```jsx import { InsightChart } from '@chartbuddy.io/embed/react'; export function Revenue({ grid }) { return ( ); } ``` The chart fills its container, so **give the container a height**. A container with no height renders nothing visible. ## Without a bundler (CDN / single HTML file) The bindings import `react` as a bare specifier, so a plain HTML page needs an **import map** to tell the browser where React lives. This is the whole setup — no build step: ```html
``` Two things to get right: * The import map must map **both** `react` and `@chartbuddy.io/embed/react`. The subpath needs the explicit `.mjs` file — bare-specifier subpath resolution does not work in browsers. * Use `React.createElement` (aliased to `h` above) rather than JSX, since there is no build step to compile JSX. Import maps need a modern browser. If you are generating a standalone artifact for an AI host and JSX or import maps are awkward, skip React entirely and use the plain [`Insight`](https://chartbuddy.io/embed/docs/api.md) API or the [custom element](https://chartbuddy.io/embed/docs/guides/angular.md#other-frameworks) — both work with a single `