Skip to the page
TACTILE UI

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
  1. Use it
  2. Options
  3. Methods
  4. States
  5. How it works
  6. Built with
01

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>
02

Options

OptionTypeDefaultWhat it does
orgtext'Harwick Lido Trust'Organisation
kickertext'Community share offer'The small outlined label above the headline.
headlinetext'Reopen the Lido.'Headline
ledetext'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
raisednumber, 0 to 999999187420Where the drums start. Pledges roll it up from there.
goalnumber, 1000 to 999999250000Goal
stretchnumber, 1000 to 999999320000The end of the rope. Set it to the goal to have none.
stretchNotetext'heats the water to 24°'Stretch goal buys
backersnumber, 0 to 999992318Backers
daysLeftnumber, 0 to 36512Days left
deadlinetext'14 June'Deadline
currencyGBP · EUR · USD'GBP'Currency
pledgenumber, 1 to 999925What the main button pledges. Press it: the drums roll by that much.
livebooleantrueSimulated pledges arrive every few seconds while the section is in view (14 at most), with a pause button.
palettelido · chalk'lido'Deep pool water, or white tiles in pool-marking blue.
finishbone · ink · steel · brass'bone'Drums
lightnumber, 0 to 345315Light from (degrees)
03

Methods

mount(element, options, { Odometer })
Builds the block inside the element and returns its handle. Hand it the Odometer it is built with.
handle.odometers
handle.raised
handle.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.
04

States

  1. At restThe total stands on the drums engraved “Raised so far”; the rope shows the funded share; four recent pledges with their ages.
  2. 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.
  3. Visitor pledgesThe button lands the visitor’s own pledge, highlighted, rolls the drums, and a polite status line confirms it.
  4. PausedA real toggle (aria-pressed) stops arrivals (WCAG 2.2.2) and the live label reads “Paused”.
  5. CappedAt most 14 simulated pledges a visit; the feed never loops forever.
  6. PaletteLido (deep pool water, cream signage, red-and-cream floats) or chalk (white tiles in pool-marking blue); tokens from one table.
  7. TabletOne column, the feed under the tally, the lane line dropped.
  8. PhoneStats in three equal columns with the backers counter shrinking to fit, a full-width button, compact feed items.
  9. Reduced motionTotals change without a roll, the rope does not ease, pledges appear without sliding, the dot does not ping; every number still updates.
  10. Off screenThe timer is cleared and the drums sleep; arrivals resume on return.
05

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.

06

Built with

More blocks on the same object:

Docs
Finish
Volume