Skip to content

Commit a17d13a

Browse files
committed
Update CLAUDE.md
1 parent 049ac67 commit a17d13a

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

packages/charts/CLAUDE.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,23 +192,25 @@ import { BarChartPlaceholder } from '@ui5/webcomponents-react-charts/BarChartPla
192192

193193
## Responsive Behavior
194194

195-
Charts default to `width: 100%` and `height: 400px`.
195+
Charts default to `width: 100%` and `height: 400px`, so they render out of the box without container configuration.
196196

197-
**Important:** Charts require a container with **fixed dimensions**. They won't render correctly in containers that derive size from their children (e.g., `height: auto`, flex without explicit height):
197+
**Important:** If you override chart dimensions with relative values (e.g., `height: '100%'`), the container must have fixed dimensions. Charts won't render correctly in containers that derive size from their children:
198198

199199
```tsx
200-
// ❌ Won't work - parent has no fixed height
200+
// ❌ Won't work - chart uses 100% height but parent has no fixed height
201201
<div style={{ display: 'flex' }}>
202-
<BarChart {...props} />
202+
<BarChart style={{ height: '100%' }} {...props} />
203203
</div>
204204
205-
// ✅ Works - explicit dimensions on container or chart
205+
// ✅ Works - container has fixed height for percentage-based chart
206206
<div style={{ height: '400px' }}>
207-
<BarChart {...props} />
207+
<BarChart style={{ height: '100%' }} {...props} />
208208
</div>
209209
210-
// ✅ Or override via style prop
211-
<BarChart style={{ height: '300px', width: '500px' }} {...props} />
210+
// ✅ Works - using default dimensions (no container height needed)
211+
<div>
212+
<BarChart {...props} />
213+
</div>
212214
```
213215

214216
## Limitations
@@ -226,7 +228,7 @@ Charts default to `width: 100%` and `height: 400px`.
226228

227229
**Sizing:**
228230

229-
- Charts require containers with **fixed dimensions** (won't render in `height: auto` containers)
231+
- When using relative dimensions (e.g., `height: '100%'`), containers must have fixed dimensions
230232
- Default: `width: 100%`, `height: 400px`
231233

232234
**Styling:**

0 commit comments

Comments
 (0)