[object Promise]

# SparkLineChart API

## Demos

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

- [Charts - Sparkline](/x/react-charts/sparkline/)

## Import

```jsx
import { SparkLineChart } from '@mui/x-charts/SparkLineChart';
// or
import { SparkLineChart } from '@mui/x-charts';
// or
import { SparkLineChart } from '@mui/x-charts-pro';
// or
import { SparkLineChart } from '@mui/x-charts-premium';
```

## Props

| Name | Type | Default | Required | Description |
|------|------|---------|----------|-------------|
| data | `Array<number>` | - | Yes |  |
| apiRef | `{ current?: object }` | - | No |  |
| area | `bool` | `false` | No |  |
| axisHighlight | `{ x?: 'band' \| 'line' \| 'none', y?: 'band' \| 'line' \| 'none' }` | - | No |  |
| baseline | `'max' \| 'min' \| number` | `0` | No |  |
| brushConfig | `{ enabled?: bool, preventHighlight?: bool, preventTooltip?: bool }` | - | No |  |
| children | `node` | - | No |  |
| clipAreaOffset | `{ bottom?: number, left?: number, right?: number, top?: number }` | `{ top: 1, right: 1, bottom: 1, left: 1 }` | No |  |
| color | `func \| string` | `rainbowSurgePalette[0]` | No |  |
| curve | `'bumpX' \| 'bumpY' \| 'catmullRom' \| 'linear' \| 'monotoneX' \| 'monotoneY' \| 'natural' \| 'step' \| 'stepAfter' \| 'stepBefore'` | `'linear'` | No |  |
| dataset | `Array<object>` | - | No |  |
| desc | `string` | - | No |  |
| disableAxisListener | `bool` | `false` | No |  |
| disableClipping | `bool` | `false` | No |  |
| disableHitArea | `bool` | - | No |  |
| disableKeyboardNavigation | `bool` | - | No |  |
| experimentalFeatures | `{ enablePositionBasedPointerInteraction?: bool, keyboardActivation?: bool, progressiveRendering?: bool }` | - | No |  |
| focusItemOnClick | `bool` | `false` | No |  |
| height | `number` | - | No |  |
| hiddenItems | `Array<{ dataIndex?: number, seriesId: string, type: 'bar' } \| { dataIndex?: number, seriesId: string, type: 'line' } \| { dataIndex?: number, seriesId: string, type: 'pie' } \| { dataIndex?: number, seriesId: string, type: 'radar' } \| { dataIndex?: number, seriesId: string, type: 'scatter' } \| { dataIndex?: number, seriesId: string, type?: 'bar' } \| { dataIndex?: number, seriesId: string, type?: 'line' } \| { dataIndex?: number, seriesId: string, type?: 'pie' } \| { dataIndex?: number, seriesId: string, type?: 'radar' } \| { dataIndex?: number, seriesId: string, type?: 'scatter' }>` | - | No |  |
| highlightedAxis | `Array<{ axisId: number \| string, dataIndex: number }>` | - | No |  |
| highlightedItem | `{ dataIndex?: number, seriesId: string } \| { dataIndex?: number, seriesId: string, type: 'bar' } \| { dataIndex?: number, seriesId: string, type: 'line' } \| { dataIndex?: number, seriesId: string, type: 'pie' } \| { dataIndex?: number, seriesId: string, type: 'radar' } \| { dataIndex?: number, seriesId: string, type: 'scatter' }` | - | No |  |
| hitAreaRadius | `'item' \| number` | - | No |  |
| id | `string` | - | No |  |
| initialHiddenItems | `Array<{ dataIndex?: number, seriesId: string, type: 'bar' } \| { dataIndex?: number, seriesId: string, type: 'line' } \| { dataIndex?: number, seriesId: string, type: 'pie' } \| { dataIndex?: number, seriesId: string, type: 'radar' } \| { dataIndex?: number, seriesId: string, type: 'scatter' } \| { dataIndex?: number, seriesId: string, type?: 'bar' } \| { dataIndex?: number, seriesId: string, type?: 'line' } \| { dataIndex?: number, seriesId: string, type?: 'pie' } \| { dataIndex?: number, seriesId: string, type?: 'radar' } \| { dataIndex?: number, seriesId: string, type?: 'scatter' }>` | - | No |  |
| localeText | `object` | - | No |  |
| margin | `number \| { bottom?: number, left?: number, right?: number, top?: number }` | `5` | No |  |
| onAxisClick | `function(event: ChartsActivationEvent, data: null \| ChartsAxisData) => void` | - | No |  |
| onHiddenItemsChange | `function(hiddenItems: Array<VisibilityIdentifierWithType>) => void` | - | No |  |
| onHighlightChange | `function(highlightedItem: HighlightItemIdentifierWithType<SeriesType> \| null) => void` | - | No |  |
| onHighlightedAxisChange | `function(axisItems: Array<AxisItemIdentifier>) => void` | - | No |  |
| onItemClick | `function(event: ChartsActivationEvent, scatterItemIdentifier: ScatterItemIdentifier) => void` | - | No |  |
| onTooltipAxisChange | `function(axisItems: Array<AxisItemIdentifier>) => void` | - | No |  |
| onTooltipItemChange | `function(tooltipItem: SeriesItemIdentifier<SeriesType> \| null) => void` | - | No |  |
| plotType | `'bar' \| 'line'` | `'line'` | No |  |
| showHighlight | `bool` | `false` | No |  |
| showTooltip | `bool` | `false` | No |  |
| skipAnimation | `bool` | - | No |  |
| slotProps | `object` | `{}` | No |  |
| slots | `object` | `{}` | No |  |
| sx | `Array<func \| object \| bool> \| func \| object` | - | No | The system prop that allows defining system overrides as well as additional CSS styles. |
| theme | `'dark' \| 'light'` | - | No |  |
| title | `string` | - | No |  |
| tooltipAxis | `Array<{ axisId: number \| string, dataIndex: number }>` | - | No |  |
| tooltipItem | `{ dataIndex: number, seriesId: string } \| { dataIndex: number, seriesId: string, type: 'bar' } \| { dataIndex: number, seriesId: string, type: 'pie' } \| { dataIndex: number, seriesId: string, type: 'scatter' } \| { dataIndex?: number, seriesId: string } \| { dataIndex?: number, seriesId: string, type: 'line' } \| { dataIndex?: number, seriesId: string, type: 'radar' }` | - | No |  |
| valueFormatter | `function(value: number) => string` | `(value: number | null) => (value === null ? '' : value.toString())` | No |  |
| width | `number` | - | No |  |
| xAxis | `object` | - | No |  |
| yAxis | `object` | - | No |  |

> **Note**: The `ref` is forwarded to the root element (HTMLDivElement).

> Any other props supplied will be provided to the root element (native element).

## Theme default props

You can use `MuiSparkLineChart` to change the default props of this component with the theme.

## Slots

| Name | Default | Class | Description |
|------|---------|-------|-------------|
| area | `AnimatedArea` | - | The component that renders the area. |
| bar | `BarElementPath` | - | The component that renders the bar. |
| line | `LineElementPath` | - | The component that renders the line. |
| lineHighlight | `LineHighlightElement` | - | The component that renders the line highlight. |
| mark | `MarkElement` | - | The component that renders the marks. |
| tooltip | `ChartsTooltipRoot` | - | Custom component for the tooltip popper. |

## Source code

If you did not find the information on this page, consider having a look at the implementation of the component for more detail.

- [/packages/x-charts/src/SparkLineChart/SparkLineChart.tsx](https://github.com/mui/material-ui/tree/HEAD/packages/x-charts/src/SparkLineChart/SparkLineChart.tsx)