Skip to main content
161

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Web docs
Data displayGlass surface

PieChart

Shows part-to-whole relationships as an accessible donut or pie chart.

FrameworksAstro · React · Elements

Registry commandlumen add PieChart

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

Framework usage

1 series, 4 points. Values range from 8 to 46.

  • Astro
  • React
  • Web Components
  • Other
2,480 Projects
View chart data
CategoryValueShare
Astro4646%
React3131%
Web Components1515%
Other88%
Share of active Lumen projects.

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 { PieChart } from '@santi020k/lumen-astro'

const series = {
  data: [
    { label: 'Astro', x: 'astro', y: 46 },
    { label: 'React', x: 'react', y: 31 },
    { label: 'Web Components', x: 'elements', y: 15 },
    { label: 'Other', x: 'other', y: 8 }
  ],
  id: 'frameworks',
  label: 'Framework share'
}
---

<PieChart
  aria-label="Package usage by framework"
  caption="Share of active Lumen projects."
  centerLabel="Projects"
  centerValue="2,480"
  heading="Framework usage"
  {series}
/>
Edit PieChart 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 PieChart
lumen add PieChart

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

Framework share

1 series, 3 points. Values range from 13 to 58.

  • Astro
  • React
  • Elements
1,280 Projects
View chart data
CategoryValueShare
Astro5858%
React2929%
Elements1313%

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 { PieChart } from '@santi020k/lumen-astro'

const series = {
  data: [
    { label: 'Astro', x: 'astro', y: 58 },
    { label: 'React', x: 'react', y: 29 },
    { label: 'Elements', x: 'elements', y: 13 }
  ],
  id: 'frameworks',
  label: 'Framework share'
}
---

<div class="docs-glass-demo">
  <PieChart
    aria-label="Framework share"
    centerLabel="Projects"
    centerValue="1,280"
    glass
    heading="Framework share"
    {series}
  />
</div>
Edit PieChart 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.
seriesLumenChartSeriesrequiredProvides one already-aggregated series whose positive finite data points become slices.
variant"donut" | "pie""donut"Uses a center opening by default or renders a traditional pie.
centerLabel, centerValuestring | ReactNode-Adds optional visual summary content in the donut center.
showLegendbooleantrueShows the color-independent category key.
showTablebooleantrueProvides a revealable semantic table with category, value, and share columns.
valueFormatter(value: number) => stringStringFormats values in SVG titles and the semantic table for Astro and React; Web Components expose the equivalent JavaScript property.
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