Skip to content

Block 287 of 297

Data Wave Bars

Showcase chart of up to 12 bindable values as glowing, breathing bars, with every figure listed as text.

Puck key
DataWaveBarsBlock
Export
dataWaveBarsBlock
React component
<DataWaveBars />
Files
components/puck/data-wave-bars-block.tsx
components/puck/data-wave-bars.client.tsx
Dependencies
vgpu
License
MIT

About this block

When to use it, how to write for it, and what to change in the code.

What it's for

A feature bar chart for up to 12 values, with rounded, glowing bars that rise and fall in a slow wave on a dark panel and the highest bar lit in a peak color. A summed total and the peak value sit beside the heading. On phones the per-bar values are hidden visually and only the labels show under the bars.

  • Monthly visitor, attendance or usage counts for a year
  • Seasonal program enrollment or trail counter data
  • A grant report chart where one peak tells the story
Writing the content
  • Values takes comma-separated numbers with no thousands separators, like 4210, 4830; bind them to a P1 data source with {{ }} tokens.
  • Labels should match Values one for one. Missing labels fall back to #1, #2 and so on.
  • Unit attaches directly when it's one character, like %, and with a space when longer, like visits.
  • Leave Total label blank when a sum doesn't make sense, such as for percentages.
Accessibility
  • The data is an ordered list labelled by the heading, with each value and the peak announced in text; the bars are aria-hidden (WCAG 1.1.1).
  • The peak is called out in words ("Peak · Jul") as well as color (WCAG 1.4.1).
  • Reduced motion stops the wave with each bar at its true height, and the canvas pauses off screen or in a hidden tab.
Customizing the code
  • Requires vgpu and data-wave-bars.client.tsx. HEADROOM in the shader sets how tall the tallest bar gets, and the glow falloff constants sit in the same loop.
  • Chart height is h-56 sm:h-72 lg:h-80, and the eyebrow uses indigo-700.

Editor fields

What content editors see in the P1 sidebar when they select this block.

  • Eyebrowtext
  • Headingtextarea
  • Heading levelselect
  • Bodytextarea
  • Valuestext
  • Labelstext
  • Unittext
  • Total labeltext
  • Footnotetext
  • Panel colortext
  • Bar colortext
  • Peak colortext
  • Motionradio