06.2Block 06.2 · Stats & KPIs
Goal Tally
A fundraiser’s total on big printed drums. They roll up as each pledge lands, beside a feed of named supporters and a lane-rope rail to the goal. Pledge, and your £25 carries through.
- Version
- 0.1.0
- Size
- 47.4 KB gzipped
- Access
- With a Pass
- Needs
- goal-tally.mjs + goal-tally.css · Odometer
- Tests
- 8 tests · 10 states
On this page
Use it
Show money arriving rather than a figure that changed: for a crowdfunder, a charity appeal, a community share offer or a pre-order campaign, the total is a machine people watch, the backers are people with reasons, and the progress rail belongs to the cause.
Copy the goal-tally folder and the odometer folder from its package next to your page, link the stylesheets and mount it on an element. Every option has a default; the lab’s Code tab writes the same example at any settings, and for React, Vue, Svelte or a custom element (Using a framework).
<link rel="stylesheet" href="odometer/odometer.css">
<link rel="stylesheet" href="goal-tally/goal-tally.css">
<div id="goal-tally"></div>
<script type="module">
import Odometer from './odometer/odometer.mjs';
import { mount } from './goal-tally/goal-tally.mjs';
const goalTally = mount(document.getElementById('goal-tally'), {
org: 'Harwick Lido Trust',
kicker: 'Community share offer',
headline: 'Reopen the Lido.',
}, { Odometer });
// goalTally.update({ … }); change any option in place
// goalTally.destroy(); and take it away again
</script>Options
| Option | Type | Default | What it does |
|---|---|---|---|
| org | text | 'Harwick Lido Trust' | Organisation |
| kicker | text | 'Community share offer' | The small outlined label above the headline. |
| headline | text | 'Reopen the Lido.' | Headline |
| lede | text | 'Harwick’s 1936 open-air pool has been shut since 2019. Raise £250,000 by 14 June and the council matches it pound for pound, to fix the filtration and open the gates for summer 2027.' | Lede |
| raised | number, 0 to 999999 | 187420 | Where the drums start. Pledges roll it up from there. |
| goal | number, 1000 to 999999 | 250000 | Goal |
| stretch | number, 1000 to 999999 | 320000 | The end of the rope. Set it to the goal to have none. |
| stretchNote | text | 'heats the water to 24°' | Stretch goal buys |
| backers | number, 0 to 99999 | 2318 | Backers |
| daysLeft | number, 0 to 365 | 12 | Days left |
| deadline | text | '14 June' | Deadline |
| currency | GBP · EUR · USD | 'GBP' | Currency |
| pledge | number, 1 to 9999 | 25 | What the main button pledges. Press it: the drums roll by that much. |
| live | boolean | true | Simulated pledges arrive every few seconds while the section is in view (14 at most), with a pause button. |
| palette | lido · chalk | 'lido' | Deep pool water, or white tiles in pool-marking blue. |
| finish | bone · ink · steel · brass | 'bone' | Drums |
| light | number, 0 to 345 | 315 | Light from (degrees) |
Methods
mount(element, options, { Odometer })- Builds the block inside the element and returns its handle. Hand it the Odometer it is built with.
handle.odometershandle.raisedhandle.pledge(p)- Land a pledge from code: { name, place, amount, note }.
handle.update(next_ = {})- Change options in place.
handle.destroy()- Stops it and cleans up after it.
States
- At restThe total stands on the drums engraved “Raised so far”; the rope shows the funded share; four recent pledges with their ages.
- Pledge arrivesEvery 4.5–8 s while in view: a named pledge slides into the feed, the total and backers roll with their carries, the rope pays out over 1.4 s, the live dot pings once.
- Visitor pledgesThe button lands the visitor’s own pledge, highlighted, rolls the drums, and a polite status line confirms it.
- PausedA real toggle (aria-pressed) stops arrivals (WCAG 2.2.2) and the live label reads “Paused”.
- CappedAt most 14 simulated pledges a visit; the feed never loops forever.
- PaletteLido (deep pool water, cream signage, red-and-cream floats) or chalk (white tiles in pool-marking blue); tokens from one table.
- TabletOne column, the feed under the tally, the lane line dropped.
- PhoneStats in three equal columns with the backers counter shrinking to fit, a full-width button, compact feed items.
- Reduced motionTotals change without a roll, the rope does not ease, pledges appear without sliding, the dot does not ping; every number still updates.
- Off screenThe timer is cleared and the drums sleep; arrivals resume on return.
How it works
Made of: Rolling total, Simulated pledge feed, Pausable live updates, Lane rope progress rail, Visibility gated timer, Palette tokens from one table.
Read more: How the Odometer carries · Odometer, odometer.js, NumberFlow.
Original composition; the Harwick Lido Trust, its campaign and every supporter are invented. Imagery is CSS only (tiles, lane line, rope). Face: National Park (SIL OFL 1.1), Latin subsets as WOFF2.
Built with
More blocks on the same object:
- 06.1Pricing DrumsA price printed on brass drums.
- 06.3Trip ComputerAn instrument cluster as a stats band.
- 06.4Specimen CaseA bento of glass-topped compartments in a machined case, each holding one real Tactile object running small (the Odometer, the Flip-Dot, the Detent Dial, the Vessel) with an engraved label card under the glass.