Skip to content

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';

Learn about the difference by reading this guide on minimizing bundle size.

Props

NameTypeDefaultDescription
bottomAxisobject
| string
xAxisIds[0] The id of the first provided axis

Indicate which axis to display the bottom of the charts. Can be a string (the id of the axis) or an object ChartsXAxisProps.

leftAxisobject
| string
yAxisIds[0] The id of the first provided axis

Indicate which axis to display the left of the charts. Can be a string (the id of the axis) or an object ChartsYAxisProps.

rightAxisobject
| string
null

Indicate which axis to display the right of the charts. Can be a string (the id of the axis) or an object ChartsYAxisProps.

slotPropsobject{}

The props used for each component slot.

slotsobject{}

Overridable component slots.

See Slots API below for more details.

topAxisobject
| string
null

Indicate which axis to display the top of the charts. Can be a string (the id of the axis) or an object ChartsXAxisProps.

The component cannot hold a ref.

CSS classes

These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.

Class nameRule nameDescription
.MuiChartsAxis-bottombottomStyles applied to the bottom axis.
.MuiChartsAxis-directionXdirectionXStyles applied to x-axes.
.MuiChartsAxis-directionYdirectionYStyles applied to y-axes.
.MuiChartsAxis-labellabelStyles applied to the group containing the axis label.
.MuiChartsAxis-leftleftStyles applied to the left axis.
.MuiChartsAxis-linelineStyles applied to the main line element.
.MuiChartsAxis-rightrightStyles applied to the right axis.
.MuiChartsAxis-rootrootStyles applied to the root element.
.MuiChartsAxis-ticktickStyles applied to ticks.
.MuiChartsAxis-tickContainertickContainerStyles applied to group including the tick and its label.
.MuiChartsAxis-tickLabeltickLabelStyles applied to ticks label.
.MuiChartsAxis-toptopStyles applied to the top axis.

You can override the style of the component using one of these customization options:

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.