Area chart
Area chart with a bright line over a dithered fill; ranges morph into each other and hover adds a crosshair and the value.
Your data
Pass your daily values as data. Without it the chart shows demo data seeded from label. See Your data.
Playground
Change a prop and the component updates. Props marked live animate to the new value; the others rebuild the element.
<HfArea label="Tokens per day" days={30} />Installation
pnpm dlx shadcn@latest add @lumesec/hf-areaFirst timeRegister the @lumesec registry once, or install by URL
Adds @lumesec to your components.json:
pnpm dlx shadcn@latest registry add @lumesec=https://elements.lumesec.ai/r/{name}.jsonOr skip the setup and install by URL:
npx shadcn@latest add https://elements.lumesec.ai/r/hf-area.jsonUsage
import { HfArea } from "@/components/lumesec/hf-area";
export function Example() {
return (
<HfArea label="Tokens per day" />
);
}Behaviour
A bright line over a dithered fill that thins toward the bottom. Ranges morph into each other; hovering adds a crosshair, a bloom on the point and the value in the header.
API reference
Attributes
labelReact proplabelTypestringDefaultTokens per dayHeader label and start of the chart aria-label. Without data it also seeds the demo data. Observed.
daysReact propdaysTypenumberDefault30Range in days, at least 1. The range buttons offer 7, 30 and 90. Observed: changing it switches the range.
dataReact propdataTypereadonly HfAreaDatum[] (JSON)Daily values, oldest first: numbers or { value, date } records (date as an ISO string or epoch ms). Observed: changing it morphs to the new series. Without it the chart shows demo data.
Properties
dataTypereadonly HfAreaDatum[] | nullThe same series as the data attribute, without JSON. Setting it redraws the chart; null returns to the demo data. Reading it returns your series or null.
Accessibility
- The canvas has
role="img"and anaria-labelof the form<label>, last <n> days, <first> to <last>. - The range buttons are native buttons in a
role="group"labelledRange, witharia-pressed. - Hovered values and dates are pointer-only.
- Reduced motion: the line is drawn in full at once, range changes swap without morphing, the header value changes without rolling and the canvas redraws only on input.
Theming
The element reads your shadcn theme tokens through its shadow root, so light and dark follow your theme. The accent comes from --lumesec. See Theming.
This component reads --border, --card, --foreground, --lumesec, --muted and --muted-foreground.
To restyle only LumeSec elements, set the matching --ui-* overrides: --ui-accent, --ui-border, --ui-fg, --ui-font, --ui-muted, --ui-raised, --ui-surface and --ui-track.
Notes
- With
data, the range buttons show the last 7, 30 or 90 entries; shorter data shows every entry. Dates label the axis and the tooltip; without dates the days count back from today. - Values are drawn from zero up; negative values sit on the baseline.
- The header shows the latest value, or the hovered day, and the change from the first to the last day of the range.
data,labelanddaysare observed. Adatavalue set before the element is defined is picked up when it upgrades.
Related
Was this page helpful?