Getting startedComponentsDesign tokensThemingTheme synthesizerFrameworksAccessibilityUtilitiesServer renderingBrowser supportContributingChangelogApp ShellAspect GridAuth ShellCenterContainerDashboard GridFloat BarInsetMasonryPage HeaderPage LayoutResizableResponsive SwitcherSectionSettings LayoutSplit PaneStatus BarStickyToolbarAnchor NavBottom NavBreadcrumbBreadcrumb MenuCommand BarDrawerFooterLinkMenubarNavigation MenuPage IndicatorPaginationRailScroll IndicatorScroll SpyScroll To TopSidebarSkip LinkStepper NavTabsTop BarTree ViewAccordionAspect RatioAvatarAvatar GroupCardCarouselCollapsibleColor SwatchCTA BannerDividerEmpty StateFeature CardIconImageImage CompareImage HotspotsInfinite ScrollLightboxMarqueeQR CodeScroll AreaSkeletonSpinnerStackVideoVirtual ListActivity HeatmapAnimated NumberBadgeBar ListChartClockComparisonCountdown TimerData GridDescription ListDiffGaugeJSON TreeKanbanLevel MeterListMeterSparklineStatStepperTagTimelineUptimeValue CardWaveformBlockquoteCode BlockCode GroupGradient TextHighlightKbdKeyboard MapMarkdownNumber FormatProseTerminalTextTime AgoTruncateTypewriterButtonButton GroupCalendarCheckboxChipColor PickerComboboxCopy ButtonDate PickerDate Range PickerField ListFieldsetFile UploadFormHotkeyIcon ButtonImage CropperInline EditInputInput GroupKnobLabelMasked InputMulti SelectNumber InputPassword InputPin InputRadio GroupRange SliderRatingSearchSegmented ControlSelectSignature PadSliderSortable ListSwitch GroupTag InputTextareaTheme ToggleTime PickerToggleTransfer ListTree SelectAlertAnnouncementBannerCommand PaletteConfirmConnection StatusContext MenuConversationDialogDropdown MenuHover CardLoading OverlayNotification PanelPopoverProgressSheetToastTooltip
ARC UIARC Radiant Components
v4.9DocsComponentsTokensSynthesizer
Getting startedFrameworksServer renderingDesign tokensThemingTheme synthesizerTypographyUtilitiesAll componentsAccessibilityBrowser supportChangelogContributingStatsApp ShellAspect GridAuth ShellCenterContainerDashboard GridFloat BarInsetMasonryPage HeaderPage LayoutResizableResponsive SwitcherSectionSettings LayoutSplit PaneStatus BarStickyToolbarAnchor NavBottom NavBreadcrumbBreadcrumb MenuCommand BarDrawerFooterLinkMenubarNavigation MenuPage IndicatorPaginationRailScroll IndicatorScroll SpyScroll To TopSidebarSkip LinkStepper NavTabsTop BarTree ViewAccordionAspect RatioAvatarAvatar GroupCardCarouselCollapsibleColor SwatchCTA BannerDividerEmpty StateFeature CardIconImageImage CompareImage HotspotsInfinite ScrollLightboxMarqueeQR CodeScroll AreaSkeletonSpinnerStackVideoVirtual ListActivity HeatmapAnimated NumberBadgeBar ListChartClockComparisonCountdown TimerData GridDescription ListDiffGaugeJSON TreeKanbanLevel MeterListMeterSparklineStatStepperTagTimelineUptimeValue CardWaveformBlockquoteCode BlockCode GroupGradient TextHighlightKbdKeyboard MapMarkdownNumber FormatProseTerminalTextTime AgoTruncateTypewriterButtonButton GroupCalendarCheckboxChipColor PickerComboboxCopy ButtonDate PickerDate Range PickerField ListFieldsetFile UploadFormHotkeyIcon ButtonImage CropperInline EditInputInput GroupKnobLabelMasked InputMulti SelectNumber InputPassword InputPin InputRadio GroupRange SliderRatingSearchSegmented ControlSelectSignature PadSliderSortable ListSwitch GroupTag InputTextareaTheme ToggleTime PickerToggleTransfer ListTree SelectAlertAnnouncementBannerCommand PaletteConfirmConnection StatusContext MenuConversationDialogDropdown MenuHover CardLoading OverlayNotification PanelPopoverProgressSheetToastTooltip

Sparkline

A small inline line or bar chart, drawn as SVG from a comma-separated string of numbers.

ComponentsSparkline
datastatic
<arc-sparkline>

Overview

Sparkline is a small trend chart, 120 by 32 pixels by default. Put it in a table cell next to a metric, beside a stat card, or in a dashboard grid. It has no axes, labels or tooltips. For those, use a full chart. Pass the values as a comma-separated string in `data`. `type="line"` draws a line with rounded joins, and `fill` adds a shaded area under it. `type="bar"` draws evenly spaced bars that fill in more strongly on hover. The line draws itself in over 800ms when it first renders, and appears at once under `prefers-reduced-motion`. The color is `--accent-primary` by default. `color` takes any CSS color, such as `var(--color-success)` for revenue or `#dc2626` for an error rate, and an `"r, g, b"` triplet still works. It sets the line, the area under it at 10% opacity, and the bars at 30% (60% on hover).

Guidelines

Do

  • Keep data short, 5 to 20 points. Past about 30 the chart becomes an unreadable blob
  • Use a line for continuous trends like revenue over time or request latency
  • Use bars for discrete counts like daily totals or categories
  • Set `fill` to stress how large a trend is, not only its direction

Don't

  • Don't base important decisions on a sparkline alone. It has no axes, labels or precision
  • Don't put dozens of line sparklines in one table. Each one draws itself in, and there's no setting to turn that off

Features

  • A baseline rule in `--border-subtle`
  • CSS parts `svg`, `line`, `area` and `bar`
  • `display: inline-block` with `vertical-align: middle`, so it lines up with surrounding text
  • The SVG is `aria-hidden`, so screen readers skip it. Put the number it illustrates in visible text

Preview

Line
Line + fill
Bar

Usage

<script type="module" src="@arclux/arc-ui"></script>

<!-- Line sparkline -->
<arc-sparkline data="10,25,18,30,22,35,28,40,32" type="line"></arc-sparkline>

<!-- Line with area fill -->
<arc-sparkline data="10,25,18,30,22,35,28,40,32" type="line" fill></arc-sparkline>

<!-- Bar sparkline -->
<arc-sparkline data="10,25,18,30,22,35,28,40,32" type="bar"></arc-sparkline>

<!-- Custom size and color -->
<arc-sparkline
  data="5,12,8,20,15,25,18"
  type="line"
  width="200"
  height="48"
  color="var(--color-success)"
></arc-sparkline>

API

datastring''
Comma-separated numeric values that define the chart data points (e.g. "10,25,18,30,22,35,28"). Parsed into a number array at render time. Non-numeric entries are silently dropped.
colorstring''
Color for the line, the area under it and the bars. Takes any CSS color (#16a34a, green, var(--color-success)) or an "r, g, b" triplet. The area fill is the color at 10% opacity and bars at 30% (60% on hover). Defaults to var(--accent-primary) when not set.
type'line' | 'bar''line'
Chart type. Line renders a polyline with optional area fill; bar renders evenly spaced rectangles.
widthnumber120
SVG viewport width in pixels.
heightnumber32
SVG viewport height in pixels.
fillbooleanfalse
When true and type is "line", fills the area beneath the curve with color at 10% opacity.

See also