[object Promise]

# BarChart API

## Demos

For examples and details on the usage of this React component, visit the component demo pages:

- [Charts - Bar demos](/x/react-charts/bar-demo/)
- [Charts - Bars](/x/react-charts/bars/)
- [Charts - Label](/x/react-charts/label/)

## Import

```jsx
import { BarChart } from '@mui/x-charts/BarChart';
// or
import { BarChart } from '@mui/x-charts';
// or
import { BarChart } from '@mui/x-charts-pro';
// or
import { BarChart } from '@mui/x-charts-premium';
```

## Props

| Name | Type | Default | Required | Description |
|------|------|---------|----------|-------------|
| series | `Array<object>` | - | Yes |  |
| apiRef | `{ current?: object }` | - | No |  |
| axesGap | `number` | `0` | No |  |
| axisHighlight | `{ x?: 'band' \| 'line' \| 'none', y?: 'band' \| 'line' \| 'none' }` | - | No |  |
| borderRadius | `number` | - | No |  |
| brushConfig | `{ enabled?: bool, preventHighlight?: bool, preventTooltip?: bool }` | - | No |  |
| children | `node` | - | No |  |
| colors | `Array<string> \| func` | `rainbowSurgePalette` | No |  |
| dataset | `Array<object>` | - | No |  |
| desc | `string` | - | No |  |
| disableAxisListener | `bool` | `false` | No |  |
| disableKeyboardNavigation | `bool` | - | No |  |
| experimentalFeatures | `{ keyboardActivation?: bool }` | - | No |  |
| focusItemOnClick | `bool` | `false` | No |  |
| grid | `{ horizontal?: bool, vertical?: bool }` | - | No |  |
| height | `number` | - | No |  |
| hiddenItems | `Array<{ dataIndex?: number, seriesId: string, type: 'bar' } \| { dataIndex?: number, seriesId: string, type?: 'bar' }>` | - | No |  |
| hideLegend | `bool` | - | No |  |
| highlightedAxis | `Array<{ axisId: number \| string, dataIndex: number }>` | - | No |  |
| highlightedItem | `{ dataIndex?: number, seriesId: string } \| { dataIndex?: number, seriesId: string, type: 'bar' }` | - | No |  |
| id | `string` | - | No |  |
| initialHiddenItems | `Array<{ dataIndex?: number, seriesId: string, type: 'bar' } \| { dataIndex?: number, seriesId: string, type?: 'bar' }>` | - | No |  |
| layout | `'horizontal' \| 'vertical'` | `'vertical'` | No |  |
| loading | `bool` | `false` | No |  |
| localeText | `object` | - | No |  |
| margin | `number \| { bottom?: number, left?: number, right?: number, top?: number }` | - | No |  |
| onAxisClick | `function(event: ChartsActivationEvent, data: null \| ChartsAxisData) => void` | - | No |  |
| onHiddenItemsChange | `function(hiddenItems: Array<VisibilityIdentifierWithType>) => void` | - | No |  |
| onHighlightChange | `function(highlightedItem: HighlightItemIdentifierWithType<SeriesType> \| null) => void` | - | No |  |
| onHighlightedAxisChange | `function(axisItems: Array<AxisItemIdentifier>) => void` | - | No |  |
| onItemClick | `function(event: ChartsActivationEvent \| ChartsActivationEvent<SVGElement>, barItemIdentifier: BarItemIdentifier) => void` | - | No |  |
| onTooltipAxisChange | `function(axisItems: Array<AxisItemIdentifier>) => void` | - | No |  |
| onTooltipItemChange | `function(tooltipItem: SeriesItemIdentifier<SeriesType> \| null) => void` | - | No |  |
| renderer | `'svg-batch' \| 'svg-single'` | `'svg-single'` | No |  |
| showToolbar | `bool` | `false` | No |  |
| skipAnimation | `bool` | - | No |  |
| slotProps | `object` | `{}` | No |  |
| slots | `object` | `{}` | No |  |
| sx | `Array<func \| object \| bool> \| func \| object` | - | No | The system prop that allows defining system overrides as well as additional CSS styles. |
| theme | `'dark' \| 'light'` | - | No |  |
| title | `string` | - | No |  |
| tooltipAxis | `Array<{ axisId: number \| string, dataIndex: number }>` | - | No |  |
| tooltipItem | `{ dataIndex: number, seriesId: string } \| { dataIndex: number, seriesId: string, type: 'bar' }` | - | No |  |
| width | `number` | - | No |  |
| xAxis | `Array<object>` | - | No |  |
| yAxis | `Array<object>` | - | No |  |

> **Note**: The `ref` is forwarded to the root element (HTMLDivElement).

> Any other props supplied will be provided to the root element (native element).

## Theme default props

You can use `MuiBarChart` to change the default props of this component with the theme.

## Slots

| Name | Default | Class | Description |
|------|---------|-------|-------------|
| axisLabel | `ChartsText` | - | Custom component for axis label. |
| axisLine | `'line'` | - | Custom component for the axis main line. |
| axisTick | `'line'` | - | Custom component for the axis tick. |
| axisTickLabel | `ChartsText` | - | Custom component for tick label. |
| bar | `BarElementPath` | - | The component that renders the bar. |
| barLabel | `BarLabel` | - | The component that renders the bar label. |
| baseButton | `Button` | - | The component used for buttons. |
| baseIconButton | `IconButton` | - | The component used for icon buttons. |
| baseToggleButton | `ToggleButton` | - | The component used for toggle buttons.
Note: MUI's `ToggleButton` has an incompatible `href` prop, so it must be cast:
`ToggleButton as unknown as React.ComponentType`. |
| baseToggleButtonGroup | `ToggleButtonGroup` | - | The component used for toggle button groups. |
| legend | `ChartsLegend` | - | Custom rendering of the legend. |
| loadingOverlay | `ChartsLoadingOverlay` | - | Overlay component rendered when the chart is in a loading state. |
| noDataOverlay | `ChartsNoDataOverlay` | - | Overlay component rendered when the chart has no data to display. |
| toolbar | `ChartsToolbar` | - | Custom component for the toolbar. |
| tooltip | `ChartsTooltipRoot` | - | Custom component for the tooltip popper. |
| xAxis | `ChartsXAxis` | - | Custom component for the x-axis. |
| yAxis | `ChartsYAxis` | - | Custom component for the y-axis. |

## Source code

If you did not find the information on this page, consider having a look at the implementation of the component for more detail.

- [/packages/x-charts/src/BarChart/BarChart.tsx](https://github.com/mui/material-ui/tree/HEAD/packages/x-charts/src/BarChart/BarChart.tsx)

# BarElement API

## Demos

For examples and details on the usage of this React component, visit the component demo pages:

- [Charts - Bar demos](/x/react-charts/bar-demo/)
- [Charts - Bars](/x/react-charts/bars/)

## Import

```jsx
import { BarElement } from '@mui/x-charts/BarChart';
// or
import { BarElement } from '@mui/x-charts';
// or
import { BarElement } from '@mui/x-charts-pro';
// or
import { BarElement } from '@mui/x-charts-premium';
```

## Props

| Name | Type | Default | Required | Description |
|------|------|---------|----------|-------------|
| dataIndex | `number` | - | Yes |  |
| layout | `'horizontal' \| 'vertical'` | - | Yes |  |
| seriesId | `string` | - | Yes |  |
| skipAnimation | `bool` | - | Yes |  |
| xOrigin | `number` | - | Yes |  |
| yOrigin | `number` | - | Yes |  |
| classes | `object` | - | No | Override or extend the styles applied to the component. |
| hidden | `bool` | - | No |  |
| slotProps | `object` | `{}` | No |  |
| slots | `object` | `{}` | No |  |

> **Note**: The `ref` is forwarded to the root element.

## Slots

| Name | Default | Class | Description |
|------|---------|-------|-------------|
| bar | `BarElementPath` | - | The component that renders the bar. |

## CSS

### Rule name

| Global class | Rule name | Description |
|--------------|-----------|-------------|
| - | element | Styles applied to an individual bar element. |
| - | label | Styles applied to an individual bar label. |
| - | labelAnimate | Styles applied to a bar label when it is animated. |
| - | root | Styles applied to the bar plot element. |
| - | series | Styles applied to the group surrounding a series' bar elements. |
| - | seriesLabels | Styles applied to the group surrounding a series' labels. |

## Source code

If you did not find the information on this page, consider having a look at the implementation of the component for more detail.

- [/packages/x-charts/src/BarChart/BarElement.tsx](https://github.com/mui/material-ui/tree/HEAD/packages/x-charts/src/BarChart/BarElement.tsx)

# BarPlot API

## Demos

For examples and details on the usage of this React component, visit the component demo pages:

- [Charts - Bar demos](/x/react-charts/bar-demo/)
- [Charts - Bars](/x/react-charts/bars/)

## Import

```jsx
import { BarPlot } from '@mui/x-charts/BarChart';
// or
import { BarPlot } from '@mui/x-charts';
// or
import { BarPlot } from '@mui/x-charts-pro';
// or
import { BarPlot } from '@mui/x-charts-premium';
```

## Props

| Name | Type | Default | Required | Description |
|------|------|---------|----------|-------------|
| borderRadius | `number` | - | No |  |
| className | `string` | - | No |  |
| onItemClick | `function(event: ChartsActivationEvent \| ChartsActivationEvent<SVGElement>, barItemIdentifier: BarItemIdentifier) => void` | - | No |  |
| renderer | `'svg-batch' \| 'svg-single'` | `'svg-single'` | No |  |
| skipAnimation | `bool` | `undefined` | No |  |
| slotProps | `object` | `{}` | No |  |
| slots | `object` | `{}` | No |  |

> **Note**: The `ref` is forwarded to the root element.

> Any other props supplied will be provided to the root element (native element).

## Slots

| Name | Default | Class | Description |
|------|---------|-------|-------------|
| bar | `BarElementPath` | - | The component that renders the bar. |
| barLabel | `BarLabel` | - | The component that renders the bar label. |

## Source code

If you did not find the information on this page, consider having a look at the implementation of the component for more detail.

- [/packages/x-charts/src/BarChart/BarPlot.tsx](https://github.com/mui/material-ui/tree/HEAD/packages/x-charts/src/BarChart/BarPlot.tsx)