Skip to content
Eskais UI

Data

Quantity

Honest values: formatQuantity() and QuantityValue show unknown as a dash, estimated with ~ and screen reader text, and the source in the title.

Example

Measured
18,240
Estimated
$0.42 (estimated)
Derived
3
Unknown
unknown

Installation

npx shadcn@latest add @eskais/quantity
Brings alonglocale

Usage

Import
import { defaultQuantityLabels, formatQuantity, isQuantity } from "@/lib/quantity"import { QuantityValue } from "@/components/ui/quantity-value"

API reference

QuantityValue

PropTypeDefault
valuerequiredQuantity–

Also takes <span> attributes and render except children, FormatQuantityOptions.

Other exports

defaultQuantityLabelsformatQuantityisQuantitytype FormatQuantityOptionstype FormattedQuantitytype Qualitytype Quantitytype QuantityLabelstype QuantityValueProps

Accessibility

  • Unknown shows as a dash and estimated with ~; the title explains where a value comes from.

Agent actions

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.