Skip to main content

DrugSearch

ComplexMedications<co-drug-search>

DrugSearch finds a medication with form, RxNorm, plan coverage and DEA schedule shown in each result.

import { DrugSearch } from 'health-components';

Examples​

Open​

Storybook

No Matches​

Storybook

Unknown Plan​

Storybook

Usage​

<DrugSearch payer="Aetna" options={drugs} onSelect={setDrug} />

When to use​

  • Starting a new prescription.

When not to use​

  • Picking from the current list: MedicationList.

Variants and states​

VariantWhat it is
covered / prior authCoverage text in meta.
controlledSchedule badge.

Accessibility​

  • Combobox pattern.

Do and don't​

  • Do: Show coverage before the provider picks.
  • Don't: Hide the schedule.

Props​

PropTypeDefaultDescription
options *DrugOption[]—Array<{label, form?, rxnorm?, coverage?, schedule?}>; required
labelstring"Medication"Field label
payerstring"the patient's plan"Payer whose formulary is shown, in the footer
onSelect(drug: DrugOption) => voidnoneCalled with the chosen drug
styleCSSProperties—Inline style of the root
errorstringnoneError message (as TextField)
openbooleanundefined (uncontrolled)Controlled open state of the list
placeholderstringnoneExample text in the empty input
requiredbooleanfalseRed asterisk plus aria-required
querystringundefined (uncontrolled)Controlled query text
defaultQuerystring""Initial query (uncontrolled)
onQueryChange(query: string) => void—Called when the query text changes
defaultOpenbooleanfalseOpen on first render (uncontrolled)
onOpenChange(open: boolean) => void—Called when the list opens or closes
limitnumber8Maximum results shown
emptyTextstring"No matches. Check the spelling or search by MRN."Text when nothing matches
helperstringnoneMuted hint under the field

Also accepts native attributes, including defaultChecked, autoFocus, onInput, readOnly, type, disabled, name, max, step, accept, autoComplete, checked, maxLength, min, multiple, plus className and event handlers on the root element.

Angular, Vue and HTML​

Register the elements once (Angular guide), then use <co-drug-search>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.

Angular template
<co-drug-search label="…" payer="…" [options]="options" (co-select)="onSelect($event.detail)"></co-drug-search>
KindNameDescription
property / JSON attributeoptionsArray<{label, form?, rxnorm?, coverage?, schedule?}>; required
attributelabelField label; default "Medication"
attributepayerPayer whose formulary is shown, in the footer; default "the patient's plan"
attributedefault-checked / defaultChecked
attributeauto-focus / autoFocus
property / JSON attributestyleInline style of the root
attributeread-only / readOnly
attributeerrorError message (as TextField); default none
property / JSON attributetype
attributedisabled
attributename
property / JSON attributemax
property / JSON attributestep
attributeopenControlled open state of the list; default undefined (uncontrolled)
attributeplaceholderExample text in the empty input; default none
attributeaccept
property / JSON attributeauto-complete / autoComplete
attributechecked
attributemax-length / maxLength
property / JSON attributemin
attributemultiple
attributerequiredRed asterisk plus aria-required; default false
attributequeryControlled query text; default undefined (uncontrolled)
attributedefault-query / defaultQueryInitial query (uncontrolled); default ""
attributedefault-open / defaultOpenOpen on first render (uncontrolled); default false
attributelimitMaximum results shown; default 8
attributeempty-text / emptyTextText when nothing matches; default "No matches. Check the spelling or search by MRN."
attributehelperMuted hint under the field; default none
eventco-selectCalled with the chosen drug; default none (React: onSelect)
eventco-input (React: onInput)
eventco-query-changeCalled when the query text changes (React: onQueryChange)
eventco-open-changeCalled when the list opens or closes (React: onOpenChange)