Dimension Input

Dimension Input is a copy-paste React component that stops wrong package size ships before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/dimension-input
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsWrong package size ships

Was this component page useful?

How do I install Dimension Input?

pnpm dlx shadcn@latest add @bollard/dimension-input

The files land in your project. They're yours to edit.

How do I use Dimension Input in React?

dimension-input-usage.tsx
import { DimensionInput, type DimensionValue } from "@/components/ui/dimension-input"

<DimensionInput label="Cabin bag size" category="carry-on" value={dims} onValueChange={setDims} />

What input mistakes does Dimension Input catch?

  • The wrong unit for the item category (cm entered as inches)
  • A side with an extra digit
  • Sides entered in an unexpected order
  • Pasted sizes like "16 x 12 x 8 in", split into fields
  • Courier volumetric weight, using your divisor

What props does Dimension Input accept?

DimensionInput props
PropTypeDefault
label

Group label.

string"Dimensions"
value

Controlled value.

DimensionValue—
defaultValue

Initial value when uncontrolled.

DimensionValue{ w: "", h: "", d: "", unit: "cm" }
onValueChange

Called on every change, including a pasted "40 x 30 x 20 cm" that fills all three sides.

(value: DimensionValue) => void—
category

What is being measured, to judge sizes and side order. A built-in key or your own ranges.

keyof typeof DIMENSION_CATEGORIES | DimensionCategory—
units

Units offered in the picker.

DimensionUnit[]["cm", "mm", "m", "in", "ft"]
axisLabels

Names for each side.

Record<Axis, string>{ w: "Width", h: "Height", d: "Depth" }
volumetricDivisor

Courier divisor in cm³/kg for the volumetric weight readback (5000 for express couriers); null hides it.

number | null5000
volumetricLabel

Text after the volumetric weight.

string"volumetric"
unitLabel

Label of the unit picker.

string"Unit"
messages

Override any message or fix label.

Partial<typeof DIMENSION_MESSAGES>—

* required. Also accepts the native props of <fieldset> (className, aria-*, data-*…), passed through to it.

How is Dimension Input accessible?

  • Each side and the unit have their own <label>
  • Fields are described by an aria-live="polite" status
  • Highlight animation respects prefers-reduced-motion

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Plausibility checks need a category; without one it only reads back
  • The default volumetric divisor may not match your courier

What expensive mistakes does Dimension Input stop?

Wrong package size ships

Also known as

dimensions · lxwxh · length width height · package size · shipping · volumetric weight · shiprocket · listing

Field type

What dependencies does Dimension Input require?

Dimension Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameDimension Input
Registry identifier@bollard/dimension-input
Install commandnpx shadcn@latest add @bollard/dimension-input
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Dimension Input

How does Dimension Input prevent financial transaction errors?

Dimension Input prevents wrong package size ships. Blocks The wrong unit for the item category (cm entered as inches), A side with an extra digit, Sides entered in an unexpected order, Pasted sizes like "16 x 12 x 8 in", split into fields, Courier volumetric weight, using your divisor before processing. Limitation: apply idempotency keys for dimension-input.

How do I install dimension-input with shadcn?

Run `npx shadcn@latest add @bollard/dimension-input`. Sources added: registry/default/dimension-input/dimension-input.tsx, registry/default/dimension-input/dimension.ts. Package requirements: lucide-react.

What props customize Dimension Input?

Dimension Input accepts `label`, `value`, `defaultValue`, `onValueChange`, `category`. Configures dimensions, lxwxh, length width height behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of dimension-input?

Plausibility checks need a category; without one it only reads back. The default volumetric divisor may not match your courier Server requirement: backend verification for dimension-input.

How does Dimension Input meet accessibility guidelines?

Each side and the unit have their own <label>. Fields are described by an aria-live="polite" status. Highlight animation respects prefers-reduced-motion. Minimizes errors: length width height wrong unit, volumetric weight calculator.

Which components pair with Dimension Input?