Skip to content

Block 247 of 297

Progress Goals

Labelled progress bars for several goals showing current of target and percent, with exceeded goals marked.

Puck key
ProgressGoalsBlock
Export
progressGoalsBlock
React component
<ProgressGoals />
Path
components/puck/progress-goals-block.tsx
Dependencies
None
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 card listing several goals, each with a progress bar, a "current of target" line and a percentage. Goals that pass their target fill the bar, mark where the target fell and show a Goal exceeded badge. A goal with no target shows its total without a bar. Up to twelve goals fit in one card.

  • Annual service goals on a nonprofit impact page
  • Capital campaign or scholarship fund progress
  • Department targets in an internal quarterly review
Writing the content
  • Enter Current and Target as numbers, or bind them with {{ item.field }}; formatting like commas is handled for you.
  • Put a currency symbol such as $ in Unit and it goes before the number; other units like hrs or meals go after.
  • Leave Target blank or 0 for a running count without a goal; the row then reads "No target set".
  • Keep Goal name short, since the percentage sits on the same line.
Accessibility
  • Each bar uses role="progressbar" with min, max and current values, plus an aria-valuetext such as "3,200 hrs of 5,000 hrs, 64%" (WCAG 4.1.2).
  • Bars are labeled by their goal name, and the goal list is labeled by the card title.
  • "Goal exceeded" is written out in a badge, so the state does not depend on the darker bar segment.
Customizing the code
  • Bar fill is bg-indigo-600 and the over-goal segment bg-indigo-900; swap both for your palette.
  • Leading currency symbols are matched by the [$€£¥] pattern in withUnit; add others there.

Editor fields

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

  • Titletext
  • Heading levelselect
  • Period or subtitletext
  • Goalsarray
  • Footnotetext