Framework-agnostic web components for engineering values with live unit conversion. Drop a single <script> tag into any HTML page.
<script src="https://unpkg.com/physical-quantity@latest/dist/pq.umd.js"></script>
Single physical quantity with an interactive unit dropdown.
Also aliased as
<physical-quantity>.
<uc-qty value="25.4" unit="mm"> </uc-qty>
<uc-qty value="1.6180339" unit="m" decimal-places="4"> </uc-qty>
<uc-qty value="9.81" unit="m/s²" show-unit-arrow="false"> </uc-qty>
<uc-qty value="30.5" unit="in"> </uc-qty>
<uc-qty value="5" unit="kg"> </uc-qty>
<uc-qty value="100" unit="°C"> </uc-qty>
<uc-qty value="100" unit="N"> </uc-qty>
<uc-qty value="14.7" unit="psi"> </uc-qty>
<uc-qty value="2.5" unit="A"> </uc-qty>
<uc-qty value="746" unit="W"> </uc-qty>
<uc-qty value="3.785" unit="L" decimal-places="3"> </uc-qty>
Drop <uc-qty>
directly into running text — readers click to convert without leaving context.
The column is
Operating temperature range:
Tank capacity is
Two values sharing one unit category — both convert simultaneously with a single selector.
<uc-qty-pair values="600x900" unit="mm"> </uc-qty-pair>
<uc-qty-pair values="(12.5, 37.8)" unit="cm"> </uc-qty-pair>
<uc-qty-pair values="1x2" unit="ft" decimal-places="3"> </uc-qty-pair>
<uc-qty-pair values="30.5x45.375" unit="in"> </uc-qty-pair>
Three values sharing one unit — ideal for 3-D dimensions (W × D × H).
<uc-qty-triplet values="600x400x300" unit="mm"> </uc-qty-triplet>
<uc-qty-triplet values="10x20x30" unit="in"> </uc-qty-triplet>
<uc-qty-triplet values="1x1x1" unit="m" decimal-places="4"> </uc-qty-triplet>
All HTML attributes supported across the three components.
| Attribute | Type | Default | Applies to · Description |
|---|---|---|---|
| value | number | required | <uc-qty> — Initial numeric value to display |
| values | string | required |
<uc-qty-pair>
<uc-qty-triplet>
— "AxB" or
"(A, B)" for pair;
"AxBxC" for triplet
|
| unit | string | required |
<uc-qty>
<uc-qty-pair>
<uc-qty-triplet>
— Unit identifier, e.g.
mm,
kg,
°C,
A,
psi
|
| decimal-places | integer | 2 | <uc-qty> <uc-qty-pair> <uc-qty-triplet> — Decimal precision of the displayed value; integers drop trailing zeros |
| show-unit-arrow | boolean | true |
<uc-qty>
— Set false
to hide the dropdown and render in compact, display-only mode
|