Prepared Docs

Prepared Docs

⌘K

    Loading navigation…

User

  1. Components
  2. Counter
  3. API and Development

Counter

API and Development

View Source
Submit Issue

Counter formats value with locale-aware grouping (no decimal digits) and centers it in a fully rounded pill. CounterSize selects Small or Regular text. In @prepared911/ui-core, CounterColor selects Default, Subtle, or Error. In @prepared911/ui/counter, the same roles are Selected, Resting, and Destructive. Pass className to place the counter, for example to pin it over the control it counts for.

Props

Name

Type

Default

Description

value

string | number

—

The numeric value to display

className

string

—

Class applied to the counter root. Use it to place the counter, for example to pin it over an icon as an unread badge.

color

CounterColor

CounterColor.Default

The color of the counter

size

CounterSize

CounterSize.Regular

The size of the counter

Storybook

Interactive examples and edge cases for this component are in Storybook.

Default
Subtle
Error
Small
Both Sizes
All Colors
Large Numbers

Default

Subtle

Error

Solid error fill, for unread counts that need to pull the eye. @prepared911/ui-core names this CounterColor.Error. @prepared911/ui names it CounterColor.Destructive.

Design system color (@prepared911/ui)

Import Counter from @prepared911/ui/counter. CounterColor.Destructive is the solid destructive fill (--color-status-destructive-solid with --color-status-destructive-on-solid) for an urgent count. It is the one-to-one replacement for CounterColor.Error.

@prepared911/ui-core@prepared911/ui
CounterColor.DefaultCounterColor.Selected
CounterColor.SubtleCounterColor.Resting
CounterColor.ErrorCounterColor.Destructive

Small

Both sizes

Large numbers

Previous

Counter / Usage

Next

Counter / Accessibility

On this page

Props
Storybook
Default
Subtle
Error
Design system color (@prepared911/ui)
Small
Both sizes
Large numbers