Basic Usage
Variants
Semantic variants color the line to match the rest of your UI. These are the same six variants used by Progress, Slider, and Ring.Area Fill
Setfill=True to shade the area under the line. The fill color inherits from the variant with a gradient that fades to transparent.
Step Curve
Setcurve="step" to connect points with discrete jumps instead of straight lines.
Custom Colors
Useindicator_class for colors beyond the built-in variants. Since the sparkline line is an SVG stroke, use stroke-* classes.
Size and Stroke
Control dimensions withheight and css_class for width. Use stroke_width to adjust line thickness.
In a Table
Sparklines sit naturally in table cells. UseTable (not DataTable) since sparklines are components, not plain values.
API Reference
Sparkline Parameters
Flat list of numeric values, or a
{{ field }} interpolation reference.Chart height in pixels.
Visual variant:
"default", "success", "warning", "destructive", "info", "muted".Tailwind classes for the line/fill. Use
stroke-* classes for color overrides.Show a gradient area fill under the line.
Line interpolation style between data points.
Line thickness in pixels.
Chart mode:
"line" draws a polyline, "bar" draws vertical bars.Tailwind classes for the outer container. Use
w-* classes to control width.Protocol Reference
Sparkline