The numbers a calculation starts from (inputs, leaves): where they came from, when they were true, and whether they are still fresh.
import { Given } from "@umriss-ui/calculation";
A given with asOf and ages carries a freshness through core, as a Stat does – beside the number, never instead of its verdict. There are no default ages.
The operator words, the reasons for absence and the number formats are core's wording; German comes from @umriss-ui/core/wording/de (ADR-0019).
source, asOf and ages give a given its origin and freshness; explanation and aside stand beside a line without taking part.
import { useState } from "react";
import { Sparkline } from "@umriss-ui/core";
import { Calculation, Given, Quotient } from "@umriss-ui/calculation";
const AGES = { stale: 15 * 60_000, lost: 60 * 60_000 };
export default function WhereItCameFrom() {
const [now] = useState(() => Date.now());
return (
<Calculation aria-label="Error rate of Checkout, last five minutes">
<Quotient
label="Error rate, Checkout"
format="percent"
decimals={2}
limits={[{ value: 0.01, side: "upper", severity: "warning" }]}
explanation="Failed requests over every request in the last five minutes."
aside={<Sparkline data={[0.0012, 0.0015, 0.0011, 0.0019, 0.0264, 0.0287]} aria-hidden="true" />}
>
<Given label="Failed requests" value={118} unit="requests" source="Load balancer logs" asOf={now - 4 * 60_000} ages={AGES} />
<Given label="Requests" value={4390} unit="requests" source="Request counter" asOf={now - 22 * 60_000} ages={AGES} />
</Quotient>
</Calculation>
);
}
asOf alone shows the time a number held; there are no default ages, because stale means different things on different screens.
import { Calculation, Given, Product } from "@umriss-ui/calculation";
export default function AsOf() {
return (
<Calculation aria-label="Licence cost, design tool, March">
<Product label="Licence cost, March" unit="€" decimals={2}>
<Given label="Seats in use" value={12} unit="seats" source="Admin console" asOf={new Date(2026, 2, 13, 16, 0)} />
<Given label="Price per seat" value={45} unit="€/seat" decimals={2} source="Contract with Nimbrel Software" asOf={new Date(2026, 0, 2, 8, 0)} />
</Product>
</Calculation>
);
}
Operator words, reasons and number formats come from core's LanguageProvider (ADR-0019); your labels stay as you write them.
import { LanguageProvider } from "@umriss-ui/core";
import { GERMAN_FORMATS, GERMAN_WORDING } from "@umriss-ui/core/wording/de";
import { Calculation, Chain, Given, Interim, Minus, Product, Ref } from "@umriss-ui/calculation";
export default function InGerman() {
return (
<LanguageProvider wording={GERMAN_WORDING} formats={GERMAN_FORMATS}>
<Calculation aria-label="Rechnung INV-26-0317, Messestand">
<Chain>
<Given id="stand" label="Messestand, 3 Tage" value={12400} unit="€" decimals={2} />
<Minus>
<Product label="Rabatt" unit="€" decimals={2}>
<Given label="Rabattsatz" value={0.05} format="percent" />
<Ref to="stand" />
</Product>
</Minus>
<Interim label="Nettobetrag" unit="€" decimals={2} />
</Chain>
</Calculation>
</LanguageProvider>
);
}
The keys of Calculation apply here.
GivenProps| Name | Type | Default | Description |
|---|---|---|---|
valuerequired | | number | — | The number the calculation starts from. Absent (null, undefined,
not finite) makes every quantity that depends on it absent, with the
reason - never zero. Where the calculation has metrics, an object with
a number for each metric id instead; absence then stays in its metric.Shown in: Say where a number came from, State when a number was true, Read in German and 50 more |
source | string | — | Where the number came from: a system, a report, a person. Shown in: Say where a number came from, State when a number was true, Staff movement as a chain (Metrics) and 8 more |
asOf | Date | number | — | When the number was true - not when it was fetched. Shown in: Say where a number came from, State when a number was true, The cost per stop of a day's tours (Worked examples) |
ages | FreshnessAges | — | The ages at which asOf turns stale and lost. With both, the given
carries a freshness through core; with asOf alone, only the time.Shown in: Say where a number came from, The cost per stop of a day's tours (Worked examples) |
labelrequired | string | — | What the quantity is called. It stands on its line, wherever it is an
operand, and in the accessible sentence. from QuantityPropsShown in: Say where a number came from, State when a number was true, Read in German and 50 more |
id | string | — | Makes the quantity referable: <Ref to> stands for it elsewhere. Needed
only for a quantity used more than once. from QuantityPropsShown in: Read in German, The availability of a service (Installation), Write a tree (Calculation) and 10 more |
unit | string | — | A label written after the number - "min", "pcs", "€". Never converted
and never checked; the calculation does no unit algebra. from QuantityPropsShown in: Say where a number came from, State when a number was true, Read in German and 42 more |
format | "percent" | — | percent presents a plain ratio as per cent: 0.916 is shown as 91.6 %.
The quantity stays a ratio in every operation. from QuantityPropsShown in: Say where a number came from, Read in German, The availability of a service (Installation) and 17 more |
decimals | number | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in
presentation; every operation uses the full value. from QuantityPropsShown in: Say where a number came from, State when a number was true, Read in German and 29 more |
target | number | — | The value this quantity is meant to reach - missed, never violated. from QuantityPropsShown in: The availability of a service (Installation), Write a tree (Calculation), Density (Calculation) and 6 more |
limits | readonly Limit[] | — | Bounds the quantity is assessed against, through core's assess(). from QuantityPropsShown in: Say where a number came from, Density (Calculation), Hold a figure to its limits (Tree) and 5 more |
explanation | string | — | A sentence of plain text beside the line: why the quantity is here, or
what it means. from QuantityPropsShown in: Say where a number came from, A number one metric does not have (Metrics), Staff movement as a chain (Metrics) and 2 more |
aside | ReactNode | — | Content of the caller's own beside the line - a sparkline, a link. It
never takes part in the calculation. from QuantityPropsShown in: Say where a number came from |
emphasis | "strong" | "muted" | — | How much the line stands out among the others (ADR-0049): strong to
be read first, muted to recede - a muted line still counts in full.
Not on the Result, which is already the heaviest line. from QuantityPropsShown in: A stronger line (Calculation), A quieter line (Calculation), Emphasis inside a group (Calculation) |
rule | "above" | — | above rules the line off from the ones before it, where a section
starts that is not an interim. Not on the Result. from QuantityPropsShown in: A rule above (Calculation), Emphasis inside a group (Calculation) |
MetricValuesA given's numbers where the calculation has metrics: one per metric id,
null where the number is absent.
type MetricValues = Readonly<Record<string, number | null>>;FreshnessAgesFrom @umriss-ui/core.
The two ages at which a value changes its state, in milliseconds. Both
bounds belong to the older state: exactly five minutes old is already
stale.
alt <= lost is the sensible order. Stated the other way round, the
harder statement still wins - the middle state simply falls away.
LimitFrom @umriss-ui/core.
A bound: a value, a side, a severity.
No tolerance band as input. A band is derived - two limits of equal
severity on opposite sides enclose one - and as an input type it would
force a null on one edge in the one-sided case.
| Name | Type | Default | Description |
|---|---|---|---|
valuerequired | number | — | Shown in: Say where a number came from, Density (Calculation), Hold a figure to its limits (Tree) and 3 more |
siderequired | Side"upper" | "lower" | — | Shown in: Say where a number came from, Density (Calculation), Hold a figure to its limits (Tree) and 3 more |
severityrequired | Severity"warning" | "alarm" | — | Shown in: Say where a number came from, Density (Calculation), Hold a figure to its limits (Tree) and 3 more |
SideFrom @umriss-ui/core.
Whether a limit is an upper or a lower bound.
type Side = "upper" | "lower";SeverityFrom @umriss-ui/core.
How seriously a violation weighs: one severity that advises and one that calls for action. Exactly two; for a third distinction one sets a second limit.
type Severity = "warning" | "alarm";