ChartsAxis API
API reference docs for the React ChartsAxis component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
// or
import { ChartsAxis } from '@mui/x-charts';
// or
import { ChartsAxis } from '@mui/x-charts-pro';
// or
import { ChartsAxis } from '@mui/x-charts-premium';Learn about the difference by reading this guide on minimizing bundle size.
| Name | Type | Default | Description |
|---|---|---|---|
| slotProps | object | {} | The props used for each component slot. |
| slots | object | {} | Overridable component slots. See Slots API below for more details. |
The component cannot hold a ref.
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
| Class name | Rule name | Description |
|---|---|---|
| .MuiChartsAxis-bottom | bottom | Styles applied to the bottom axis. |
| .MuiChartsAxis-directionX | directionX | Styles applied to x-axes. |
| .MuiChartsAxis-directionY | directionY | Styles applied to y-axes. |
| .MuiChartsAxis-id | id | Styles applied to the root element for the axis with the given ID. Needs to be suffixed with the axis ID: .${axisClasses.id}-${axisId}. |
| .MuiChartsAxis-label | label | Styles applied to the group containing the axis label. |
| .MuiChartsAxis-left | left | Styles applied to the left axis. |
| .MuiChartsAxis-line | line | Styles applied to the main line element. |
| .MuiChartsAxis-right | right | Styles applied to the right axis. |
| .MuiChartsAxis-root | root | Styles applied to the root element. |
| .MuiChartsAxis-tick | tick | Styles applied to ticks. |
| .MuiChartsAxis-tickContainer | tickContainer | Styles applied to group including the tick and its label. |
| .MuiChartsAxis-tickLabel | tickLabel | Styles applied to ticks label. ⚠️ For performance reasons, only the inline styles get considered for bounding box computation. Modifying text size by adding properties like font-size or letter-spacing to this class might cause labels to overlap. |
| .MuiChartsAxis-top | top | Styles applied to the top axis. |
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverridesproperty in a custom theme.
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.