Sparkline
Draws a small trend line inside a card or a table cell.
Preview
Local preview. It doesn't affect real accounts, environments, or run data.
Compare the same example at each size and density. Switching keeps input values and selection state. Size guidance and comparisons
Usage
Show the shape of a series inside a card or a table cell, next to the figure it explains. It has no axes, legend or tooltip: label states what the line shows and how it moved. Set baseline to a reference value, such as the previous close. Set fill where the shape carries the message, such as a trend card: the wash takes the same color as the line, so it adds weight without a second color.
- Don't use Sparkline when people need to read values. Use LineChart, which has axes, a readout and a table.
- Don't leave out label. The line is an image, and the label is all a screen reader hears.
- Don't fill a line that sits under a colored figure it would compete with. fill adds weight to a shape; it is not a status cue.
Size: SizeProvider size="small" resizes the whole composition, including portals. The default size is Default. Size guidance and comparisons
Anatomy
svg(role=img, aria-label) → gradient + fade under the line + baseline + line + end marker
Keyboard and accessibility
Sparkline is an image with an accessible name. It takes no focus and has no interaction.
Give each control a name that describes its purpose. Connect error messages to their controls, and signal state with more than color. Automated checks don't replace manual keyboard and assistive technology testing.
Example code
Shared components take their styles from design tokens. Each example sets its own composition and accessibility attributes. The calling screen defines callbacks, refs, and product data.
Key API
The table lists the common wrapper's main props. See the package type declarations for the full types.