
Security News
US Government Forces Anthropic to Pull Claude Fable Days After Launch
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.
physical-quantity
Advanced tools
A web component bundle to represent physical quantities with automated unit conversion.
Web Components for physical quantities with built-in unit conversion.
physical-quantity provides lightweight custom HTML elements for displaying and converting quantities directly in the page. It is designed for product specs, technical documentation, engineering content, educational material, and any interface where users benefit from viewing values in the units they already understand.
Visitors can switch units inline without leaving the page or opening a separate converter, keeping content compact while still giving readers access to the units they prefer.

This package is especially useful when your audience spans regions, industries, or disciplines that use different unit systems. Instead of filling the page with duplicate metric and imperial values, you can present one clean quantity component and let each visitor choose from most units in the same category.
This package includes three custom elements:
<uc-qty> / <physical-quantity>Displays a single quantity with a value field and a unit selector.
<uc-qty-pair>Displays two quantities that share the same unit. Useful for:
width x height)<uc-qty-triplet>Displays three quantities that share the same unit. Useful for:
length x width x height)npm install physical-quantity
This package is designed to be useful with very little setup: include the script, add the custom element, and the quantity becomes unit-aware in the page.
<script type="module" src="node_modules/physical-quantity/dist/pq.es.js"></script>
<physical-quantity value="25.4" unit="mm"></physical-quantity>
<uc-qty-pair values="10x20" unit="cm"></uc-qty-pair>
<uc-qty-triplet values="10x20x30" unit="cm"></uc-qty-triplet>
<script src="https://unpkg.com/physical-quantity@latest/dist/pq.umd.js"></script>
<physical-quantity value="25.4" unit="mm"></physical-quantity>
<uc-qty value="2" unit="lbm" decimal-places="2"></uc-qty>
<uc-qty-pair values="10x20" unit="cm"></uc-qty-pair>
Watch the demo on YouTube Shorts⭐ NEW
Live Demo 0 - primary usages ⭐ NEW
Live Demo 1 - technical writing
Live Demo 2 - typical product specs
Live Demo 3 - typical product specs
These components are most valuable anywhere physical measurements appear in content, specifications, or interfaces that serve users with different unit preferences.
Show dimensions, weight, power, capacity, and other specifications in a way that international customers can immediately understand.
Let readers switch units without scanning conversion tables or leaving the page.
Present measurements in a format that adapts to the reader’s preferred unit system without duplicating values throughout the page.
Help students and learners interact with values in familiar units while reinforcing unit literacy.
Support user-friendly presentation of measurements such as kg/lb, °C/°F, ml/oz, and similar values.
The package focuses on practical display and conversion rather than forcing users to leave the page for a separate conversion workflow.
<physical-quantity value="25.4" unit="mm" decimal-places="4"></physical-quantity>
<uc-qty value="2.5" unit="kg" decimal-places="4"></uc-qty>
<uc-qty value="25.4" unit="mm" show-unit-arrow="false"></uc-qty>
<uc-qty-pair values="10x20" unit="cm"></uc-qty-pair>
<uc-qty-pair values="(10, 20)" unit="cm"></uc-qty-pair>
<uc-qty-triplet values="10x20x30" unit="cm"></uc-qty-triplet>
<uc-qty-triplet values="(10, 20, 30)" unit="cm"></uc-qty-triplet>
<physical-quantity value="1500" unit="g"></physical-quantity>
<physical-quantity value="1500" unit="psf"></physical-quantity>
<physical-quantity value="800" unit="kg/m³"></physical-quantity>
<uc-qty value="37.778" unit="°C" show-unit-arrow="false"></uc-qty>
<uc-qty value="100" unit="°F"></uc-qty>
<uc-qty value="2'-3" unit="ft-in"></uc-qty>
<physical-quantity value="2'-3 3/16" unit="ft-in"></physical-quantity>
<physical-quantity value="10" unit="kgf"></physical-quantity>
<physical-quantity value="10" unit="Volt"></physical-quantity>
Rendered example: Above Rendered in Web Browser
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Physical Quantity Component Example</title>
<script src="https://unpkg.com/physical-quantity@latest/dist/pq.umd.js"></script>
</head>
<body>
<physical-quantity value="25.4" unit="mm"></physical-quantity>
<uc-qty value="25.4" unit="mm" decimal-places="4"></uc-qty><br>
<uc-qty-pair values="10x20" unit="cm"></uc-qty-pair><br>
<uc-qty-pair values="(10, 20)" unit="cm"></uc-qty-pair><br>
<uc-qty-triplet values="10x20x30" unit="cm"></uc-qty-triplet><br>
<uc-qty-triplet values="(10, 20, 30)" unit="cm"></uc-qty-triplet><br>
</body>
</html>
value: initial value for <physical-quantity> / <uc-qty>unit: initial unitdecimal-places: number of decimal places to display; defaults to 2show-unit-arrow: shows or hides the unit dropdown arrow; defaults to truevalues: used by <uc-qty-pair> and <uc-qty-triplet>Supported formats:
AxB or AxBxC(A, B) or (A, B, C)When unit is recognized in the supported library, the component enables conversion within that category.
When unit is not recognized, the value is still displayed, but conversion is not applied.
The unit dropdown displays other available units from the same category. Users can switch units directly in the page.
For the full list of supported units and categories, see the Units Reference.
Missing a unit or category? Email don.wen@calcslive.com with suggestions.
The same components are also available through the WordPress plugin CalcsLive Unit Converter & Sizing Calculator for Product Pages.
That gives WordPress users a no-build option via shortcodes:
[calcslive_qty value="25.4" unit="mm"]
[calcslive_qty value="2000" unit="g"]
[calcslive_qty value="2" unit="in"]
[calcslive_qty_pair values="10x20" unit="cm"]
[calcslive_qty_pair values="(10, 20)" unit="cm"]
[calcslive_qty_triplet values="10x20x30)" unit="cm"]
[calcslive_qty_triplet values="(10, 20, 30)" unit="cm"]
Because this package is built as Web Components, it works naturally in plain HTML and in projects that can render custom elements.
For framework-based apps, the main requirement is that the framework allows custom elements to pass through to the DOM cleanly.
Contributions, bug reports, feature requests, and unit suggestions are welcome.
Please contact the developer for bugs, improvements, or missing units.
See CHANGELOG.md included in the package for version history.
MIT License. See LICENSE for details.
Questions, feedback, bug reports, or unit requests:
FAQs
A web component bundle to represent physical quantities with automated unit conversion.
The npm package physical-quantity receives a total of 7 weekly downloads. As such, physical-quantity popularity was classified as not popular.
We found that physical-quantity demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.

Security News
A network of 152 Chrome live wallpaper extensions hid ad tracking and made extension-driven traffic look like Google search clicks.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.