Skip to content

YAxis API

API reference docs for the React YAxis 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 { YAxis } from '@mui/x-charts';
    You can learn about the difference by reading this guide on minimizing bundle size.

    Component name

    The name MuiYAxis can be used when providing default props or style overrides in the theme.

    Props

    NameTypeDefaultDescription
    axisId*string
    Id of the axis to render.
    classesobject
    Override or extend the styles applied to the component. See CSS API below for more details.
    disableLineboolfalse
    If true, the axis line is disabled.
    disableTicksboolfalse
    If true, the ticks are disabled.
    fillstring'currentColor'
    The fill color of the axis text.
    labelstring
    The label of the axis.
    labelFontSizenumber14
    The font size of the axis label.
    position'left'
    | 'right'
    Position of the axis.
    strokestring'currentColor'
    The stroke color of the axis line.
    tickFontSizenumber12
    The font size of the axis ticks text.
    tickSizenumber6
    The size of the ticks.

    The component cannot hold a ref.

    CSS

    Rule nameGlobal classDescription
    root.MuiYAxis-rootStyles applied to the root element.
    line.MuiYAxis-lineStyles applied to the main line element.
    tickContainer.MuiYAxis-tickContainerStyles applied to group ingruding the tick and its label.
    tick.MuiYAxis-tickStyles applied to ticks.
    tickLabel.MuiYAxis-tickLabelStyles applied to ticks label.
    label.MuiYAxis-labelStyles applied to the axis label.
    directionX.MuiYAxis-directionXStyles applied to x axes.
    directionY.MuiYAxis-directionYStyles applied to y axes.
    top.MuiYAxis-topStyles applied to the top axis.
    bottom.MuiYAxis-bottomStyles applied to the bottom axis.
    left.MuiYAxis-leftStyles applied to the left axis.
    right.MuiYAxis-rightStyles applied to the right axis.

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