# Operating Margin block

> Operating margin chart with revenue and opex bars, a margin lane, a target and hatched forecast

Fiscal year P&L by month or quarter: revenue and opex columns, an operating margin line against a dashed target, hatched forecast months, YTD stats and CSV export. Recharts in a ReUI Frame with ToggleGroup. Finance and margin dashboards.

- Type: Pro block
- Category: [Composed Chart](https://web.dev.reui.io/blocks/chart/composed-chart.md)
- Page: https://web.dev.reui.io/blocks/chart/composed-chart/chart-36
- MCP: `get_block("chart-36")`
- Built with: Badge, Button, Chart, Dropdown Menu, Frame, Icon Tile, Toggle Group, Tooltip
- Installs with a ReUI Pro or Ultimate license; setup: https://web.dev.reui.io/docs/license-setup

## Best for

Monthly or quarterly revenue against operating expenses, the operating margin they leave, a margin target and a hatched forecast

## Agent notes

- Replace `MONTHS` with revenue and operating expenses in USD thousands; `CLOSED_MONTHS` splits closed from forecast, and `FISCAL_YEAR` and `AS_OF` date it
- `PRIOR_YTD` feeds every vs last year delta and `TARGET_MARGIN` the dashed target and the FY Outlook stat; both are fixed literals
- `downloadCsv` exports the plotted periods and `copySummary` copies the fixed `SUMMARY`; neither calls an API

## When not to use

- Cash in and out by month with a running balance, a reserve floor and a waterfall: use [Cashflow Trend](https://web.dev.reui.io/blocks/chart/composed-chart/chart-21.md) (`get_block("chart-21")`)
- One quarter's revenue split into cost and profit flows: use [Revenue Flow](https://web.dev.reui.io/blocks/chart/sankey-chart/chart-48.md) (`get_block("chart-48")`)

## Third-party libraries

- Recharts v3: [API reference](https://recharts.github.io/en-US/api/), [docs](https://recharts.github.io/en-US/guide/getting-started/)
- Sonner v2: [API reference](https://sonner.emilkowal.ski/toast), [docs](https://sonner.emilkowal.ski/getting-started)

## Install

```bash
npx shadcn@latest add @reui/chart-36
```

## About Composed Chart blocks

### When to use

- Bars and a line on one time axis, such as revenue and opex columns under an operating margin line
- A measure against its goal or limit, such as closed sales against a dashed goal or latency past a limit
- Cash or liquidity flowing in and out by period, over the balance those flows add up to

### When not to use

- One volume series alone, with no goal or baseline to compare against: use the [Area Chart blocks](https://web.dev.reui.io/blocks/chart/area-chart.md)
- Two or more series drawn only as strokes across shared time buckets: use the [Line Chart blocks](https://web.dev.reui.io/blocks/chart/line-chart.md)

### Agent notes

- Every block plots in a recharts `ComposedChart` in the shadcn `ChartContainer`; a new series is one more `Bar`, `Area` or `Line` child with a `dataKey`

Every ReUI item has a twin like this one; the index is https://web.dev.reui.io/llms.txt. Agents with the ReUI MCP (https://web.dev.reui.io/docs/mcp) get the same guidance from the getters named above.
