Medication View
MedicationView is a headless read-only display of a medicine: its name, strength, form, route and frequency, each in its own part and none ever truncated. It renders as a <span>. Lily ships no drug data and no tall man list.
Status: experimental — new, implemented and unit-tested in every headless library; not yet exercised in a composed flow.
Example
hydrALAZINE 25 mg tablet oral twice daily
Show demo markup
<span class="medication-view"><span class="medication-view-name">hydr<span class="medication-view-tall-man">ALAZINE</span></span> <span class="medication-view-strength">25 mg</span> <span class="medication-view-form">tablet</span> <span class="medication-view-route">oral</span> <span class="medication-view-frequency">twice daily</span></span>
Usage example
<MedicationView
nameSegments={[{ text: "hydr" }, { text: "ALAZINE", tallMan: true }]}
strength="25 mg"
form="tablet"
route="oral"
frequency="twice daily"
/>
Show Svelte source
// In your Svelte component:
import MedicationView from "lily-design-system-svelte-headless/components/MedicationView/MedicationView.svelte";
<MedicationView>
<!-- content -->
</MedicationView>
Usage
<MedicationView
nameSegments={[{ text: "hydr" }, { text: "ALAZINE", tallMan: true }]}
strength="25 mg"
form="tablet"
route="oral"
frequency="twice daily"
/>
Props
name: string (optional) — the name as plain text
nameSegments: { text, tallMan? }[] (optional) — the name in parts, with tall man letters marked; used instead of name
strength: string (optional) — the strength, formatted by the consumer
form: string (optional) — the dose form
route: string (optional) — the route
frequency: string (optional) — how often
dosageText: string (optional) — the dose as free text (FHIR Dosage.text), when the record has no structured parts; rendered as -dosage
label: string (optional) — hidden text naming the value
...restProps: any — additional HTML attributes spread onto the root
Keyboard Interactions
None. This is not an interactive component.
ARIA
- No role and no
aria-label; label renders as hidden text. Each part is text
When to Use
- Use to show a prescribed or administered medicine.
- Use in a medication list, an administration chart or a decision-support card.
- Use wherever look-alike, sound-alike names need tall man letters.
When Not to Use
- Do not use to prescribe — use a
form with its own validated fields.
- Do not use for a non-medicine product — use plain text.
Headless
This headless component ships zero CSS and decides nothing visual. The consumer provides all styling targeting the .medication-view class hook, and every word.
Styles
.medication-view and its parts; make .medication-view-tall-man bold, never colour alone.
Testing
- Each part renders
- Only the consumer's segments are marked tall man
- A name with capitals, such as
HCl, is not marked
Advice
- Generic names in lower case except tall man letters, from the FDA and ISMP lists or your country's (Australia and Canada publish their own).
- Write mL, never cc; avoid the abbreviations on ISMP's error-prone list.
- Never truncate a medicine name; let it wrap.
Implementation Notes
- Renders
<span class="medication-view"> with parts -name, -strength, -form, -route, -frequency and -dosage
- Tall man letters come from the consumer as marked segments of the name (
nameSegments), each marked part rendered as .medication-view-tall-man; nothing is marked automatically
- The strength arrives formatted by the consumer:
formatQuantity writes 5 mg, never 5.0 mg, and 0.5 mg, never .5 mg
- No part is ever truncated
Related components
observation-view — a clinical observation or result
decision-support-card — a clinical decision support card
References
Lily™ and Lily Design System™ are trademarks.
Canonical contract
Generated from this component's canonical metadata — the machine-checked source the implementations are held to.
Metadata
- Component: medication-view
- PascalCase: MedicationView
- Description: a read-only display of a medicine, with its name, strength, form, route and frequency
- Status: experimental — new, implemented and unit-tested in every headless library; not yet exercised in a composed flow
- HTML tag: <span>
- CSS class: .medication-view
- Interactive: no
ARIA
- No role and no
aria-label; label renders as hidden text. Each part is text
Keyboard
Props
name: string (optional) — the name as plain text nameSegments: { text, tallMan? }[] (optional) — the name in parts, with tall man letters marked; used instead of name strength: string (optional) — the strength, formatted by the consumer form: string (optional) — the dose form route: string (optional) — the route frequency: string (optional) — how often dosageText: string (optional) — the dose as free text (FHIR Dosage.text), when the record has no structured parts; rendered as -dosage label: string (optional) — hidden text naming the value ...restProps: any — additional HTML attributes spread onto the root