# Bar Chart

Bars that grow in one by one over nice gridlines with counting value labels; vertical in landscape and square, horizontal in portrait.

```bash
npx shadcn add https://www.reelcn.dev/r/bar-chart.json
```

Usage:

```tsx
<Center>
  <BarChart
    data={[
      { label: "Q1", value: 42 },
      { label: "Q2", value: 58 },
      { label: "Q3", value: 51 },
      { label: "Q4", value: 87 },
    ]}
    highlight={3}
    format={{ style: "currency", currency: "USD", maximumFractionDigits: 0 }}
  />
</Center>
```

Use for:

- Comparing a handful of categories: revenue by quarter, survey answers, signups by channel
- Calling out one bar in the accent while the rest stay muted

Avoid:

- Rankings that change over time. Use `bar-race`
- Trends across many points. Use `line-chart`


## Props

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| delay? | `number` | — | Frames to wait before entering. |
| duration? | `number` | — | Enter duration in frames. Defaults to 0.6s. Some items reuse `duration` for an unrelated local timing. See that item's own prop docs. |
| exit? | `number \| boolean` | — | Exit at the end of the parent `<Sequence>`. `false` keeps it on screen, a number sets the exit length in frames. |
| motion? | `MotionPersonality` | — | Override the theme's motion personality. |
| poster? | `boolean` | — | Renders fully entered, with no exit: for a still frame or thumbnail. Defaults to `false`. |
| holdFrames? | `number` | — | Delays the start of the exit window by this many frames, for a minimum on-screen hold. Defaults to `0`. |
| data | `BarChartDatum[]` | — |  |
| orientation? | `"auto" \| "vertical" \| "horizontal"` | `"auto"` | `auto` draws vertical bars in landscape and square, horizontal bars in portrait. |
| highlight? | `number` | — | Index of the bar painted in the accent; the others turn muted. Without it every bar uses the accent. |
| width? | `number` | — | Width in design units. Defaults to the safe-area width. |
| height? | `number` | — | Height in design units. Defaults by orientation and bar count. |
| stagger? | `number` | — | Frames between bars. Defaults to 0.1s. |
| locale? | `string` | `"en-US"` | BCP 47 locale for numbers. |
| format? | `NumberFormatOptions` | — | `Intl.NumberFormat` options for value and axis labels. Defaults to the precision of the data. |
| showValues? | `boolean` | `true` |  |
| showGrid? | `boolean` | `true` |  |
| color? | `string` | — | Bar color. Defaults to the theme accent. |
| mutedColor? | `string` | — | Bars other than `highlight`. Defaults to the theme muted color at 45%. |
| labelColor? | `string` | — | Category and axis labels. Defaults to the theme muted color. |
| valueColor? | `string` | — | Value labels. Defaults to the theme foreground. |
| gridColor? | `string` | — | Gridlines. Defaults to the theme border. |
| style? | `CSSProperties` | — |  |
| className? | `string` | — |  |