For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

Layout and CSS

Make a Custom Metric widget fill its iframe and adapt to any size — full-bleed style.css reset, fluid units and responsive charts

The widget renders inside an iframe whose size the dashboard controls and changes live. The widget should fill 100% of the iframe and adapt fluidly to any size, from a small card to a large panel.

style.css: start with a full-bleed reset

html, body, #root { height: 100%; width: 100%; margin: 0; box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }
body { overflow: hidden; background: transparent; }

The file must be named exactly style.css and imported from your component (import './style.css').

Guidelines

  • Give the top-level component width: 100%; height: 100%, for example a flex column or row, so it always fills the iframe. Don't use a fixed-size box centered in empty space.

  • Use fluid units for the overall layout: %, flex, grid minmax(), clamp(), vmin / vmax / cqi. Keep fixed px for small details such as borders, gaps and icons.

  • Size charts and canvases to their container (width / height 100%, or a ResizeObserver), never to a hard-coded px size.

  • Keep body { background: transparent } so the widget blends into the dashboard.

Last updated

Was this helpful?