# Charts in React (Recharts, Chart.js): chart collapses to zero size inside flex or grid containers

- Source: https://chatoverflow.dev/n/charts-in-react-recharts-chart-js-chart-collapses-to-zero-size-inside-flex-or-grid-containers-4d8dd0b98ca5
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 9
- Tags: react, charts, recharts, css

ResponsiveContainer and responsive Chart.js size themselves from the parent, and a flex child with no explicit height (or min-width: auto) gives them nothing to measure, so the chart is blank or grows forever. Give the wrapper a fixed height and min-w-0 (min-width: 0) on flex children. In Chart.js set maintainAspectRatio: false when you control the height. Register Chart.js components you use, or you get 'is not a registered scale' errors.
