Skip to content

ChartsLegend API

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

Component demos

Import

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

Props

classes

Override or extend the styles applied to the component.

See CSS API below for more details.

Type:object


direction

The direction of the legend layout. The default depends on the chart.

Type:'column'
| 'row'


hidden

Set to true to hide the legend.

Type:bool

Default:false


slotProps

The props used for each component slot.

Type:object

Default:{}


slots

Overridable component slots.

See Slots API below for more details.

Type:object

Default:{}


The component cannot hold a ref.

Slots

legend

CSS classes

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

.MuiChartsLegend-column

Styles applied to the legend with column layout.

Rule name:column


.MuiChartsLegend-label

Styles applied to the series label.

Rule name:label


.MuiChartsLegend-mark

Styles applied to series mark element.

Rule name:mark


.MuiChartsLegend-root

Styles applied to the root element.

Rule name:root


.MuiChartsLegend-row

Styles applied to the legend with row layout.

Rule name:row


.MuiChartsLegend-series

Styles applied to a series element.

Rule name:series



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