# SparklineProps (@salmonui/charts/sparkline)

> The SparklineProps interface of @salmonui/charts/sparkline.

Canonical: https://salmonui.dev/docs/reference/charts/sparkline/SparklineProps

```ts
import type { SparklineProps } from '@salmonui/charts/sparkline';
```

Entry index: https://salmonui.dev/docs/reference/charts/sparkline (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/charts/sparkline.md).

## Reference

Kind: interface

```ts
interface SparklineProps {
    readonly data: readonly unknown[];
    readonly xField?: string | undefined;
    readonly yField?: string | undefined;
    readonly scale?: 'linear' | 'category' | 'time' | undefined;
    readonly type?: SparklineType | undefined;
    readonly width?: number | undefined;
    readonly height?: number | undefined;
    readonly color?: string | undefined;
    readonly palette?: readonly string[] | undefined;
    readonly tieColor?: string | undefined;
    readonly highlights?: Partial<Record<SparklinePointKind, SparklineHighlight>> | undefined;
    readonly markers?: 'all' | readonly SparklinePointKind[] | undefined;
    readonly labels?: 'all' | readonly SparklinePointKind[] | undefined;
    readonly format?: Intl.NumberFormatOptions | ((value: number) => string) | undefined;
    readonly locale?: string | undefined;
    readonly bands?: readonly SparklineBand[] | undefined;
    readonly domain?: {
        readonly x?: readonly [
            number,
            number
        ] | undefined;
        readonly y?: readonly [
            number,
            number
        ] | undefined;
    } | undefined;
    readonly baseline?: number | undefined;
    readonly padding?: 'none' | 'normal' | 'additional' | undefined;
    readonly tooltip?: boolean | SparklineTooltipOptions | undefined;
    readonly getPointStyle?: ((point: SparklinePoint) => SparklinePointStyle | undefined) | undefined;
    readonly onPointClick?: ((event: SparklinePointEvent) => void) | undefined;
    readonly onPointHover?: ((event: SparklinePointEvent | null) => void) | undefined;
    readonly animated?: boolean | undefined;
    readonly renderer?: 'svg' | 'canvas' | 'auto' | undefined;
    readonly canvasRenderer?: SparklineCanvasRenderer | undefined;
    readonly label?: string | undefined;
    readonly className?: string | undefined;
    readonly style?: CSSProperties | undefined;
    readonly ref?: Ref<SVGSVGElement> | undefined;
    readonly id?: string | undefined;
}
```

Members (31):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `data` | `readonly data: readonly unknown[];` |  | Numbers, or records read through `xField` / `yField`. |
| `xField` | `readonly xField?: string \| undefined;` | optional |  |
| `yField` | `readonly yField?: string \| undefined;` | optional |  |
| `scale` | `readonly scale?: 'linear' \| 'category' \| 'time' \| undefined;` | optional | How x values are read: data index / category order (`linear` without `xField`, `category`) or epoch ms (`time`). |
| `type` | `readonly type?: SparklineType \| undefined;` | optional |  |
| `width` | `readonly width?: number \| undefined;` | optional | Drawing size in px; the SVG scales to its box through `viewBox`. Default 100 x 24. |
| `height` | `readonly height?: number \| undefined;` | optional |  |
| `color` | `readonly color?: string \| undefined;` | optional | Series data color. Default the primary seed. |
| `palette` | `readonly palette?: readonly string[] \| undefined;` | optional | Data colors for column and win-loss bars, by index. |
| `tieColor` | `readonly tieColor?: string \| undefined;` | optional | Win-loss tie color (data color). |
| `highlights` | `readonly highlights?: Partial<Record<SparklinePointKind, SparklineHighlight>> \| undefined;` | optional |  |
| `markers` | `readonly markers?: 'all' \| readonly SparklinePointKind[] \| undefined;` | optional |  |
| `labels` | `readonly labels?: 'all' \| readonly SparklinePointKind[] \| undefined;` | optional |  |
| `format` | `readonly format?: Intl.NumberFormatOptions \| ((value: number) => string) \| undefined;` | optional | Label and tooltip number format. |
| `locale` | `readonly locale?: string \| undefined;` | optional |  |
| `bands` | `readonly bands?: readonly SparklineBand[] \| undefined;` | optional |  |
| `domain` | `readonly domain?: {     readonly x?: readonly [         number,         number     ] \| undefined;     readonly y?: readonly [         number,         number     ] \| undefined; } \| undefined;` | optional |  |
| `baseline` | `readonly baseline?: number \| undefined;` | optional | Value of the axis line (and the column / area base). Default 0 when the data crosses it, else none. |
| `padding` | `readonly padding?: 'none' \| 'normal' \| 'additional' \| undefined;` | optional | Range padding around the y extent. Default `normal` (half a marker). |
| `tooltip` | `readonly tooltip?: boolean \| SparklineTooltipOptions \| undefined;` | optional |  |
| `getPointStyle` | `readonly getPointStyle?: ((point: SparklinePoint) => SparklinePointStyle \| undefined) \| undefined;` | optional |  |
| `onPointClick` | `readonly onPointClick?: ((event: SparklinePointEvent) => void) \| undefined;` | optional |  |
| `onPointHover` | `readonly onPointHover?: ((event: SparklinePointEvent \| null) => void) \| undefined;` | optional |  |
| `animated` | `readonly animated?: boolean \| undefined;` | optional | Entrance transition, default `true`: set on commit (never in server markup), off under `prefers-reduced-motion`; the CSS is the opt-in `@salmonui/charts/viz-animations.css`. |
| `renderer` | `readonly renderer?: 'svg' \| 'canvas' \| 'auto' \| undefined;` | optional | Mark renderer, default `'svg'`. `'canvas'` draws the line, area, bars and markers on a canvas (bands, the axis line and labels stay SVG); `'auto'` switches at 20,000 points. Canvas needs `canvasRenderer`, else the marks stay SVG. |
| `canvasRenderer` | `readonly canvasRenderer?: SparklineCanvasRenderer \| undefined;` | optional | The canvas mark layer: `sparklineCanvas` from `@salmonui/charts/sparkline/canvas` (opt-in, so `/sparkline` stays small). |
| `label` | `readonly label?: string \| undefined;` | optional | Accessible name; default the automatic summary. |
| `className` | `readonly className?: string \| undefined;` | optional |  |
| `style` | `readonly style?: CSSProperties \| undefined;` | optional |  |
| `ref` | `readonly ref?: Ref<SVGSVGElement> \| undefined;` | optional | The root `<svg>`. |
| `id` | `readonly id?: string \| undefined;` | optional |  |
