Calm motion: animations on this site only fade, with no movement
Measure converter
An amount in one unit of length, mass, volume, or temperature in another
Does one small job fast in a tools site or a recipe page. For the packs and pieces of a stock item, use the unit converter.
Basic
v-model:kindislength,mass,volume, ortemperature. When the kind changes, the units change to a common pair, such as kilograms and pounds.v-model:amount,v-model:from, andv-model:tohold the amount and the two units. The swap button turns the units around.- The units are metric and US: millimeters to miles, grams to stones, milliliters to US gallons, and Celsius, Fahrenheit, and kelvins. The factors are exact by definition.
- The names of the units and the result come from
Intlin the language oflocale. The result keeps six significant digits, and screen readers hear it when it changes. - Change the words with
labelsor a label pack. The API table lists the keys.
The convertMeasure function and the MEASURES table do the math. They are exported for your own views.
Usage
ts
import { BlessMeasureConverter } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
locale | string | "en" | |
labels | Partial<Record<BlessMeasureKind, string> & { kind: string; amount: string; from: string; to: string; swap: string; cup: string; kelvin: string; }> | — | |
kind | BlessMeasureKind | "length" | |
amount | number | 1 | |
from | string | "kilometer" | |
to | string | "mile" |
Events
| Name | Payload | Description |
|---|---|---|
update:amount | [value: number] | |
update:from | [value: string] | |
update:to | [value: string] | |
update:kind | [value: BlessMeasureKind] |