Skip to content

ChartsXAxis API

API reference docs for the React ChartsXAxis component. Learn about the props, CSS, and other APIs of this exported module.

Demos

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

    Import

    import ChartsXAxis from '/packages/x-charts/src/ChartsXAxis';
    // or
    import { ChartsXAxis } from '/packages/x-charts/src';
    Learn about the difference by reading this guide on minimizing bundle size.

    Props

    axisIdRequired

    Id of the axis to render.

    Type:

    string

    classes

    Override or extend the styles applied to the component.

    See CSS API below for more details.

    Type:

    object

    disableLine

    If true, the axis line is disabled.

    Type:

    bool

    disableTicks

    If true, the ticks are disabled.

    Type:

    bool

    fill

    The fill color of the axis text.

    Type:

    string

    Default:

    'currentColor'

    label

    The label of the axis.

    Type:

    string

    labelFontSize

    The font size of the axis label.

    Type:

    number

    Default:

    14

    position

    Position of the axis.

    Type:

    'bottom' | 'top'

    slotProps

    The props used for each component slot.

    Type:

    object

    Default:

    {}

    slots

    Overridable component slots.

    Type:

    object

    Default:

    {}

    stroke

    The stroke color of the axis line.

    Type:

    string

    Default:

    'currentColor'

    tickFontSize

    The font size of the axis ticks text.

    Type:

    number

    Default:

    12

    tickMaxStep

    Maximal step between two ticks. When using time data, the value is assumed to be in ms. Not supported by categorical axis (band, points).

    Type:

    number

    tickMinStep

    Maximal step between two ticks. When using time data, the value is assumed to be in ms. Not supported by categorical axis (band, points).

    Type:

    number

    tickNumber

    The number of ticks. This number is not guaranted. Not supported by categorical axis (band, points).

    Type:

    number

    tickSize

    The size of the ticks.

    Type:

    number

    Default:

    6

    The component cannot hold a ref.

    CSS

    The following class names are useful for styling with CSS (the state classes are marked).
    To learn more, visit the component customization page.


    .MuiChartsXAxis-rootroot

    Styles applied to the root element.


    .MuiChartsXAxis-lineline

    Styles applied to the main line element.


    .MuiChartsXAxis-tickContainertickContainer

    Styles applied to group ingruding the tick and its label.


    .MuiChartsXAxis-ticktick

    Styles applied to ticks.


    .MuiChartsXAxis-tickLabeltickLabel

    Styles applied to ticks label.


    .MuiChartsXAxis-labellabel

    Styles applied to the axis label.


    .MuiChartsXAxis-directionXdirectionX

    Styles applied to x axes.


    .MuiChartsXAxis-directionYdirectionY

    Styles applied to y axes.


    .MuiChartsXAxis-toptop

    Styles applied to the top axis.


    .MuiChartsXAxis-bottombottom

    Styles applied to the bottom axis.


    .MuiChartsXAxis-leftleft

    Styles applied to the left axis.


    .MuiChartsXAxis-rightright

    Styles applied to the right axis.


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