BarElement API
API reference docs for the React BarElement component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import { BarElement } from '@mui/x-charts/BarChart';
// or
import { BarElement } from '@mui/x-charts';
// or
import { BarElement } from '@mui/x-charts-pro/BarChart';
// or
import { BarElement } from '@mui/x-charts-pro';
// or
import { BarElement } from '@mui/x-charts-premium/BarChart';
// or
import { BarElement } from '@mui/x-charts-premium';Learn about the difference by reading this guide on minimizing bundle size.
| Name | Type | Default | Description |
|---|---|---|---|
| color* | string | - | |
| dataIndex* | number | - | |
| height* | number | - | |
| layout* | 'horizontal' | 'vertical' | - | |
| seriesId* | string | - | |
| skipAnimation* | bool | - | |
| width* | number | - | |
| x* | number | - | |
| xOrigin* | number | - | |
| y* | number | - | |
| yOrigin* | number | - | |
| classes | Partial | - | See CSS classes API below for more details. |
| slotProps | BarElementSlotProps | {} | The props used for each component slot. |
| slots | BarElementSlots | {} | Overridable component slots. See Slots API below for more details. |
The component cannot hold a ref.
| Slot name | Class name | Default component | Description |
|---|---|---|---|
| bar | BarElementPath | The component that renders the bar. |
Source code
If you did not find the information in this page, consider having a look at the implementation of the component for more detail.