Dose Input

Dose Input is a copy-paste React component that stops ten-fold medication dose error 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/dose-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

StopsTen-fold medication dose error

Was this component page useful?

How do I install Dose Input?

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

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

How do I use Dose Input in React?

dose-input-usage.tsx
import { DoseInput } from "@/components/ui/dose-input"

<DoseInput label="Warfarin" defaultValue="5.0mg" range={{ min: 1, max: 10, unit: "mg" }} />

What input mistakes does Dose Input catch?

  • Trailing zeros (1.0 mg) and missing leading zeros (.5 mg)
  • Error-prone abbreviations: U, IU, µg, cc
  • A unit typed flush against the number, and large numbers without separators
  • Doses 10× outside the range you pass (mg typed for mcg, a slipped decimal)
  • The dose spelled back in words

What props does Dose Input accept?

DoseInput props
PropTypeDefault
label

Visible label, usually the drug name.

string"Dose"
value

Controlled text.

string—
defaultValue

Initial text when uncontrolled.

string""
onValueChange

Called with the text on every change, including one-tap fixes.

(value: string) => void—
range

Typical dose range for this drug. Doses 10× outside it are flagged with likely meant values.

DoseRange—
defaultUnit

Unit assumed and suggested when none is typed. Defaults to the range's unit.

DoseUnit—
messages

Override any string.

Partial<typeof DOSE_MESSAGES>—

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

How is Dose Input accessible?

  • Visible <label>; aria-describedby to an aria-live="polite" hint
  • aria-invalid when the dose can't be read
  • Fixes and suggested values are buttons with visible text, returning focus to the input

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

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Validate doses against the prescribing system's drug database and require clinical review; this field is a typing aid.

  • Not a clinical decision tool: it does not know the patient, the drug or safe dosing
  • Range checks only work with the range you supply
  • Not a medical device; dosing must be checked by a qualified professional

What validation rules apply to Dose Input?

Rules last verified:

Informational, not medical advice. Checked that the ISMP list covers trailing and missing leading zeros, U, IU and µg. Not every flagged pattern was matched line by line. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What expensive mistakes does Dose Input stop?

Ten-fold medication dose error

Also known as

dose · dosage · medication · prescription · mg mcg · ehr · pharmacy · healthtech

Field type

What dependencies does Dose Input require?

Dose Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameDose Input
Registry identifier@bollard/dose-input
Install commandnpx shadcn@latest add @bollard/dose-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 Dose Input

What form validation mistake does Dose Input catch?

Dose Input prevents ten-fold medication dose error. Flags error-prone dose notation as it is typed and doses ten times outside the usual range, so a slipped decimal isn't read as a ten-fold dose. Catches: Trailing zeros (1.0 mg) and missing leading zeros (.5 mg), Error-prone abbreviations: U, IU, µg, cc, A unit typed flush against the number, and large numbers without separators, Doses 10× outside the range you pass (mg typed for mcg, a slipped decimal), The dose spelled back in words. Limitation: validate dose-input schemas on backend.

How do I install dose-input with shadcn?

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

What props customize Dose Input?

Dose Input accepts `label`, `value`, `defaultValue`, `onValueChange`, `range`. Configures dose, dosage, medication behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of dose-input?

Not a clinical decision tool: it does not know the patient, the drug or safe dosing. Range checks only work with the range you supply. Not a medical device; dosing must be checked by a qualified professional Server requirement: Validate doses against the prescribing system's drug database and require clinical review; this field is a typing aid.

How does Dose Input meet accessibility guidelines?

Visible <label>; aria-describedby to an aria-live="polite" hint. aria-invalid when the dose can't be read. Fixes and suggested values are buttons with visible text, returning focus to the input. Minimizes errors: trailing zero dose, mg vs mcg.

Which components pair with Dose Input?