How to Build a Prescription (e-Prescribe) UI in React
A step-by-step guide to adding prescribing to a React healthcare app — quick medication entry and full prescriptions with dosage and priority, using pre-built, FHIR-native components.
Prescribing UI is one of those features that looks small and turns out fiddly. You need medication entry, dosage, priority, and categories — all captured cleanly and stored as a proper record connected to the patient. Build it yourself and you're writing input forms, dosage logic, and FHIR storage. With pre-built components, you get both a quick-entry widget and a full prescription form as drop-ins. This guide shows you how, step by step.
The toolkit we recommend is ClinikAPI — a FHIR-native platform with a React component library. Here's why we suggest it up front:
- Free to start: Get your API keys in seconds — no credit card needed.
- Two options:
PrescriptionWidgetfor speed,PrescriptionFormfor full detail. - Stored as FHIR: Each prescription is a connected medication record.
- Themeable: A
themeprop makes them match your app. - Compliant: HIPAA-compliant, SOC 2-audited, with a signed BAA.
Quick Answer
To build a prescription UI in React, use a pre-built FHIR-native component instead of hand-building the form. ClinikAPI offers two: PrescriptionWidget for quick medication entry, and PrescriptionForm for full prescriptions with dosage, priority, and category. You add the component, point it at a small backend route (the proxyUrl), and pass a patientId, and the medication is stored as a FHIR record connected to the chart. You skip building inputs, dosage handling, and storage. Note that the components create and store the prescription record — actually transmitting it to a pharmacy (true e-prescribing) is a separate, regulated step through a certified network. The proxy keeps your secret key server-side, and a theme prop matches your app.
See the prescription components live
Two components, two speeds
Prescribing has two modes, and there's a component for each:
- Quick entry — you just need to add a medication fast. Use
PrescriptionWidget. - Full prescription — you need dosage, priority, and category. Use
PrescriptionForm.
Pick based on the moment: a fast add versus a complete, detailed prescription.
Step 1: Install and set up the proxy
Install the components and SDK, and set up the backend proxy route:
npm install @clinikapi/react @clinikapi/sdk
Both prescription components POST { action, data } to your route; you route the prescriptions.create action to the SDK:
// app/api/clinik/route.ts — server-only
import { Clinik } from '@clinikapi/sdk'
const clinik = new Clinik(process.env.CLINIKAPI_SECRET_KEY!)
export async function POST(req: Request) {
const { action, data } = await req.json()
// Authenticate + authorize for data.patientId first.
switch (action) {
case 'prescriptions.create':
return Response.json(await clinik.prescriptions.create(data))
default:
return Response.json({ error: 'Unknown action' }, { status: 400 })
}
}
The SDK call resolves to { data, meta } — a FHIR medication record plus a meta with requestId, status, and rate-limit fields. (See the dashboard tutorial for the full route and proxyUrl="demo" mode.)
Step 2: Quick medication entry
For a fast add, the PrescriptionWidget is the lightweight option:
import { PrescriptionWidget } from '@clinikapi/react'
<PrescriptionWidget
proxyUrl="/api/clinik"
patientId={patientId}
theme="light"
/>
Step 3: Full prescription
When you need the full detail — dosage, priority, category — use PrescriptionForm:
import { PrescriptionForm } from '@clinikapi/react'
<PrescriptionForm
proxyUrl="/api/clinik"
patientId={patientId}
theme="light"
/>
Either way, the prescription is stored as a FHIR medication record, connected to the patient's chart.
The components create and store the prescription record. Transmitting it to a pharmacy — true e-prescribing — is a separate, regulated step that goes through a certified network (and, for controlled substances, EPCS). The UI gives you the data; routing to a pharmacy happens outside the UI layer. (See the DEA prescribing guide.)
What you skipped
| You skipped | Because the components do it |
|---|---|
| Medication input forms | Both components provide them |
| Dosage / priority handling | PrescriptionForm supports them |
| FHIR storage | Stored as connected medication records |
| Layout and theming | theme prop matches your app |
Product Insight: Why ClinikAPI Fits Prescribing
Prescribing data that's disconnected from the chart is dangerous. ClinikAPI keeps it connected and standard.
What you get:
PrescriptionWidget— quick medication entry.PrescriptionForm— full prescriptions with dosage, priority, category.- FHIR records — connected to the patient and your data.
- The proxy pattern — your secret key stays server-side.
- Compliance included — HIPAA-compliant, SOC 2-audited, with a signed BAA.
See them in the UI Library, and read the DEA prescribing guide for the e-prescribing side.
Frequently Asked Questions
1. How do I build a prescription UI in React?
Use ClinikAPI's PrescriptionWidget (quick entry) or PrescriptionForm (full detail). Add one with a proxyUrl and patientId, and the record is created and stored as FHIR.
2. What's the difference between the two?
PrescriptionWidget is fast, lightweight medication entry; PrescriptionForm is the full version with dosage, priority, and category.
3. Are prescriptions stored as FHIR?
Yes — as connected FHIR medication records, part of the patient's chart.
4. Do these handle e-prescribing to a pharmacy?
They create and store the record; transmitting to a pharmacy is a separate, regulated step through a certified network.
5. Can I theme them?
Yes — both take a theme prop (like light or dark).
Conclusion
Prescribing UI is fiddlier than it looks — entry, dosage, priority, and a connected record. With PrescriptionWidget and PrescriptionForm, you get both quick entry and full prescriptions as drop-ins, each stored as FHIR and connected to the chart, with no forms or storage to build. Place the component that fits the moment, provide a patient ID, and prescribing is handled — leaving the regulated pharmacy-transmission step to a certified network.
Key takeaways:
- Prescribing has two modes: quick entry and full prescription.
PrescriptionWidgetis fast;PrescriptionFormadds dosage, priority, category.- Both store the prescription as a connected FHIR medication record.
- Transmitting to a pharmacy is a separate, regulated step.
- The proxy pattern keeps your secret key server-side.
Ready to build? Explore the UI Library or get your free API keys.