Skip to main content
161

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Web docs
Data displayGlass surface

BarChart

Compares categorical or discrete-period values with grouped and stacked bars.

FrameworksAstro · React · Elements

Registry commandlumen add BarChart

InteractionNative markup

01

See it and copy it

Framework example

Choose Astro, React, or Elements to compare native usage against the shared visual output. Each example assumes the framework-level setup is already complete.

AstroSame visual contract, native framework API

Package downloads

1 series, 4 points. Values range from 4210 to 18420.

View chart data
CategoryDownloads
Lumen18,420 downloads
Astro Doctor9,870 downloads
Dep Beacon4,210 downloads
Rolling 30-day npm downloads.

Framework usage

Switch targets to compare the adapter code. The preview stays visually stable because all three packages share the same tokens and ui-* class contract.
astro
---
import { BarChart } from '@santi020k/lumen-astro'

const series = [
  {
    data: [
      { label: '18,420 downloads', x: 'Lumen', y: 18420 },
      { label: '9,870 downloads', x: 'Astro Doctor', y: 9870 },
      { label: '6,320 downloads', x: 'Astro Doctor', y: 6320 },
      { label: '4,210 downloads', x: 'Dep Beacon', y: 4210 }
    ],
    id: 'downloads',
    label: 'Downloads'
  }
]
---

<BarChart
  aria-label="Package downloads by project"
  caption="Rolling 30-day npm downloads."
  heading="Package downloads"
  orientation="horizontal"
  {series}
/>
Edit BarChart in browser
02

Choose your target

Add this component

Choose the package for your runtime. All adapters share the Lumen stylesheet. Use the matching registry command when you want a local wrapper for that framework.

bash@santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
bashAstro wrapper
lumen add BarChart
lumen add BarChart

Glass

Add the glass prop to apply the shared blur, saturation, border, and highlight tokens. Glass reads best over vivid content, so place the surface above imagery or color.

AstroSame visual contract, native framework API

Pipeline duration

1 series, 3 points. Values range from 7 to 18.

View chart data
CategoryMinutes
Build18
Test11
Deploy7

Framework usage

Switch targets to compare the adapter code. The preview stays visually stable because all three packages share the same tokens and ui-* class contract.
astro
---
import { BarChart } from '@santi020k/lumen-astro'

const series = [
  {
    data: [
      { x: 'Build', y: 18 },
      { x: 'Test', y: 11 },
      { x: 'Deploy', y: 7 }
    ],
    id: 'minutes',
    label: 'Minutes'
  }
]
---

<div class="docs-glass-demo">
  <BarChart
    aria-label="Pipeline duration"
    glass
    heading="Pipeline duration"
    {series}
  />
</div>
Edit BarChart in browser

API reference

Lumen-specific props and runtime attributes for the Astro primitive. React props follow the same names; Elements use equivalent kebab-case attributes where custom elements expose them.

AttributeValuesDefaultDescription
glassboolean | "subtle" | "strong"falseApplies the tokenized liquid-glass surface treatment with backdrop-filter fallbacks; "subtle" and "strong" adjust the fill intensity.
seriesLumenChartSeries[]requiredProvides already-aggregated categorical values and stable series metadata.
orientation"horizontal" | "vertical""vertical"Controls whether values extend across the x or y axis.
layout"grouped" | "stacked""grouped"Places series beside one another or combines their positive and negative totals.
categoryWidthnumber112Reserves 64–240 SVG units for horizontal category labels.
formatCategory, formatValueformatter functionsStringFormats axes, SVG titles, and the accessible data table without changing data identity.
emptyLabelstring"No chart data available."Provides actionable, source-specific empty-state guidance.
showLegendbooleantrue for multiple seriesShows the color-independent series key.
showTablebooleantrueProvides a revealable semantic table containing every plotted value.
heading, description, captionstring-Adds visible chart context without replacing the accessible name.
class, classNamestring""Merges custom classes with the generated ui-* root classes.
...native attributesHTML attributes-Forwards standard attributes to the root element unless the component consumes them.

Web docsFull catalog