Mass Input

A weight/volume quantity control for waste movements — a numeric input with a t / kg / m³ unit selector and a live converted equivalent when the material's reference density is known.

$bunx shadcn@latest add @nx-ui/mass-input
Registry item
Installs withdata-material-termsnative-selectnumber-inpututils

Weight only

No material supplied, so no conversion is shown — the control behaves as a plain quantity input.

Volume with material

Entering a volume of crushed concrete shows the live tonnage equivalent from the reference density.

18 t · 18,000 kg at 1.5 t/m³

Weight with material

The same control in tonnes, converting to cubic metres for a load of firm clay.

12,000 kg · 6.7 m³ at 1.8 t/m³

Unit switching

A controlled example — switch between kilograms, tonnes and cubic metres and the readout follows.

4.2 t · 3.2 m³ at 1.3 t/m³

Invalid and disabled

The invalid state marks the control with the destructive treatment; disabled greys out the whole control.

0 kg · 0.0 m³ at 1.8 t/m³

24,000 kg · 12.0 m³ at 2 t/m³

API reference

Exported parts and their props, extracted from the component source.

PropTypeDefaultDescription
valuenumber | nullControlled quantity in the current unit.
defaultValuenumberInitial quantity for uncontrolled usage.
onValueChange(value: number | null) => void
unitMassUnitControlled unit — tonnes, kilograms or cubic metres.
defaultUnitMassUnit"t"Initial unit for uncontrolled usage. Defaults to `"t"`.
onUnitChange(unit: MassUnit) => void
materialstringA material term code (e.g. `"TOPSOIL_BS3882"`) or leaf class key (e.g. `"soil.topsoil"`) — the mid reference density drives the live weight ↔ volume conversion beneath the control.
densitynumberExplicit density in t/m³. Takes precedence over `material`.
size"default" | "sm""default"
disabledboolean
invalidbooleanMarks the control as invalid (destructive border + ring).
placeholderstring
idstring
namestring
classNamestring