XAxis API
Demos
For examples and details on the usage of this React component, visit the component demo pages:
Import
import { XAxis } from '@mui/x-charts';
Component name
The nameMuiXAxis
can be used when providing default props or style overrides in the theme.Props
Name | Type | Default | Description |
---|---|---|---|
axisId* | string | Id of the axis to render. | |
classes | object | Override or extend the styles applied to the component. See CSS API below for more details. | |
disableLine | bool | false | If true, the axis line is disabled. |
disableTicks | bool | false | If true, the ticks are disabled. |
fill | string | 'currentColor' | The fill color of the axis text. |
label | string | The label of the axis. | |
labelFontSize | number | 14 | The font size of the axis label. |
position | 'bottom' | 'top' | Position of the axis. | |
stroke | string | 'currentColor' | The stroke color of the axis line. |
tickFontSize | number | 12 | The font size of the axis ticks text. |
tickSize | number | 6 | The size of the ticks. |
The component cannot hold a ref.
CSS
Rule name | Global class | Description |
---|---|---|
root | .MuiXAxis-root | Styles applied to the root element. |
line | .MuiXAxis-line | Styles applied to the main line element. |
tickContainer | .MuiXAxis-tickContainer | Styles applied to group ingruding the tick and its label. |
tick | .MuiXAxis-tick | Styles applied to ticks. |
tickLabel | .MuiXAxis-tickLabel | Styles applied to ticks label. |
label | .MuiXAxis-label | Styles applied to the axis label. |
directionX | .MuiXAxis-directionX | Styles applied to x axes. |
directionY | .MuiXAxis-directionY | Styles applied to y axes. |
top | .MuiXAxis-top | Styles applied to the top axis. |
bottom | .MuiXAxis-bottom | Styles applied to the bottom axis. |
left | .MuiXAxis-left | Styles applied to the left axis. |
right | .MuiXAxis-right | Styles applied to the right 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
styleOverrides
property in a custom theme.