Krizaka UI
Krizaka UI
Composants

Goal progress

A pot towards its goal, in money: an arc that fills, “raised of $500” under the amount, the supporters and the time left.

Web + MobileBêtaGraphiques

Web et mobile — le même composant pour React et React Native. Bêta : son API peut encore changer à une version mineure.

Pourquoi il est là. Orochia's challenge pots: raised of the goal (PS-C).

Quand l’utiliser

  • An Orochia challenge with a goal: what fans pledged so far, on the web and in the app.
  • A crowdfunded request: the amount raised, the supporters, the deadline.

Quand ne pas l’utiliser

  • An allowance that runs out.À la place : Credit usage
  • A value in a range that is not money raised.À la place : Gauge

Installation

Installer

npm install @krizaka/charts

Importer

import { GoalProgress } from "@krizaka/charts/goal";

Exemples

A challenge's pot

An Orochia goal halfway there, its supporters and the time left.

Backflip on the beach

41 supporters · 3 days left

Gauge: $262 ($500).

Backflip on the beach — data
CategoryValue
Backflip on the beach$262
min$0
max$500

Goal reached

Past the goal: the success tone, the amount still counting.

Cover of the summer hit

128 soutiens · Objectif atteint

Gauge: 1 180 € (1 000 €).

Cover of the summer hit — data
CategoryValue
Cover of the summer hit1 180 €
min0 €
max1 000 €

Props

A pot towards its goal, in money: the arc fills, the words say how much of what, and who chipped in.

PropTypeDéfautDescription
currencyrequisstring—The ISO 4217 currency.
goalrequisnumber—The goal, in minor units.
raisedrequisnumber—The amount raised, in **minor units** (cents).
titlerequisstring—What the chart shows, in a few words: its accessible name, and its heading unless hideTitle.
brandBrandId—The brand whose palette the charts use. Without it, a chart follows a .brand-<id> ancestor, else Krizaka. Set it when the app loads a brand stylesheet on :root (@krizaka/tokens/brands/orazaka.css).
classNamestring—A class on the figure (layout: margins, grid placement).
descriptionReactNode—A sentence under the title: the period, the unit, the source.
emptyReactNode—What to show when there is nothing to draw (default: the empty label). An EmptyState of @krizaka /ui fits.
errorReactNode—The data could not be loaded: true says the default words, a node says yours (a retry button…).
heightnumber—The height of the plot in pixels. Default 280 (a sparkline: 32).
hideTitleboolean—Visually hide the title (it stays the chart's accessible name): a card that already has its heading.
idstring—The id of the figure.
labelsPartial<GoalLabels>—The words, passed translated; English by default.
liveboolean—Streaming data (a job queue, an auction): no entrance on updates, no announcement of every new point.
loadingboolean—The data is on its way: a skeleton of the chart, announced once.
localeLocale—The locale of every figure and date ("fr-FR"). Default "en-US".
styleCSSProperties—Inline style on the figure (layout only: colours come from the tokens).
summary"hidden" | "visible"—The written summary: read by screen readers only ("hidden", default), or shown under the chart ("visible").
summaryTextstring—Your own summary instead of the generated one (still read first by screen readers).
supportersnumber—How many people chipped in.
timeLeftReactNode—The time left, written by the app (a Countdown, “2 days”).

Accessibilité

  • The gauge is a meter: the amount and “raised of $500” are its value in words.
  • “Goal reached” is written, never only shown by a colour.

Bonnes pratiques

  • Pass amounts in minor units and the currency.
  • Write the time left with the app's countdown and pass it in timeLeft.
  • Past the goal the amount keeps counting and the arc stays full, in the success tone.

Générée depuis le code de @krizaka/ui 3.9.0 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub

Sur cette page