Skip to content
NewYour data: charts, lists and meters that take your records
<hf-area>Custom elementData

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.

View as Markdown
<hf-area>

Tryswitch to 90D, then hover.

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.

Loading <hf-area>
Props
labellive
dayslive
<HfArea label="Tokens per day" days={30} />

Installation

pnpm dlx shadcn@latest add @lumesec/hf-area
First 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}.json

Or skip the setup and install by URL:

npx shadcn@latest add https://elements.lumesec.ai/r/hf-area.json

Usage

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 day

Header label and start of the chart aria-label. Without data it also seeds the demo data. Observed.

daysReact propdaysTypenumberDefault30

Range 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[] | null

The 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 an aria-label of the form <label>, last <n> days, <first> to <last>.
  • The range buttons are native buttons in a role="group" labelled Range, with aria-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, label and days are observed. A data value set before the element is defined is picked up when it upgrades.

Was this page helpful?