Krizaka UI
Krizaka UI
Composants

Quota meter

Space or time used against a plan: the figure in words, a meter that turns amber at 80 % and red at 95 %, the sentence that says what to do, the small figures and the way out.

Web · ✓Mobile · ✗ à construireBureau · ✓BêtaAffichage de données
import { QuotaMeter } from "@krizaka/ui/quota-meter";

Web uniquement — React, depuis @krizaka/ui/quota-meter. Bêta : son API peut encore changer à une version mineure.

  • Mobile · ✗ à construire. The native twin is a Card with a Meter; it follows when a mobile screen shows a quota (Yomizaka's library). issue #275

Pourquoi il est là. Yomizaka's library quota and Akinaza's plan (krizaka-ui#515).

Quand l’utiliser

  • A creator's or an owner's storage, minutes or credits against their plan.
  • Any limit the person can run into and should hear about before.

Quand ne pas l’utiliser

  • A bare measure with no plan, no message.À la place : Meter
  • The progress of one task.À la place : Progress

Installation

Installer

npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcss

Styles

@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";

Importer

import { QuotaMeter } from "@krizaka/ui/quota-meter";

Exemples

Storage at 86 %

Used in words, an amber meter, the sentence, minutes and today's uploads, the way to manage.

Full and paused

A red meter, the sentence, uploads on hold and the platform paused.

Props

PropTypeDéfautDescription
maxrequisnumber | null—The limit; null for no limit (no meter is drawn).
meterLabelrequisstring—The meter's accessible name.
titlerequisReactNode—What is measured (Storage), with an optional icon before it.
usedTextrequisstring—« 3.2 GB of 10 GB », said once for the eye and once for the meter's value.
valuerequisnumber—Used so far, in the unit of max.
actionReactNode—The way out, shown under the figures (a link to manage).
compactbooleanfalseLeaves out the footer (the small figures and the action): the title, the used line, the meter, the sentence and the notices stay.
detailsreadonly ReactNode[][]Small figures under the meter (minutes, today's uploads). Left out when the card is compact.
iconReactNode—A glyph before the title (decorative).
levelQuotaLevelokWhere the level stands: tones the sentence and gives an alarming one a status role.
noticesreadonly ReactNode[][]More sentences that matter (« 2 uploads on hold », « uploads are paused »), each a status.
planReactNode—The plan's name, on the right of the title.
statusTextReactNode—The sentence for that level (« You are close to your limit »).

Accessibilité

  • The card is a region named by its title.
  • The meter has its own accessible name and value text; an alarming sentence is role=status.

Bonnes pratiques

  • Say the figure in words (3.2 GB of 10 GB): the colour is never the only signal.
  • Give the sentence for each level (warning, critical, full): the alarming ones are read as a status.
  • Put the way out (action) in the card, not in a banner elsewhere.
  • max={null} for an unlimited plan: the figure stays, the meter goes.

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

Sur cette page