Skip to main content

AllergyBadge

ComplexClinical<co-allergy-badge>

AllergyBadge is the red allergy tag used in banners and lists, with severity in its title and optional label.

import { AllergyBadge } from 'health-components';

Examples​

Severities​

Storybook

Compact​

Storybook

Usage​

<AllergyBadge substance="Penicillin" severity="severe" reaction="Hives" showSeverity />

When to use​

  • Anywhere a patient is identified and a drug may be ordered.

When not to use​

  • Full allergy management: AllergyList.

Variants and states​

VariantWhat it is
severeAlert-circle icon.
moderateAlert icon.
mildAmber tone.
showSeverityAdds "(Severe)" to the text.

Accessibility​

  • Icon plus the word Allergy; severity in text when shown.

Do and don't​

  • Do: Show every allergy; wrap.
  • Don't: "+2 more" that hides an allergy.

Props​

PropTypeDefaultDescription
substance *string—Allergen ("Penicillin"); required
severityAllergySeverity'moderate''severe' | 'moderate' | 'mild'
reactionstringnoneReaction ("Anaphylaxis"), shown in the tooltip and read by screen readers
showSeveritybooleanfalseShows the severity in the label ("Allergy: Penicillin (Severe)")

Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, plus className and event handlers on the root element.

Angular, Vue and HTML​

Register the elements once (Angular guide), then use <co-allergy-badge>. 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-allergy-badge substance="…" severity="…" [defaultValue]="defaultValue"></co-allergy-badge>
KindNameDescription
attributesubstanceAllergen ("Penicillin"); required
attributeseverity'severe' | 'moderate' | 'mild'; default 'moderate'
attributereactionReaction ("Anaphylaxis"), shown in the tooltip and read by screen readers; default none
attributeshow-severity / showSeverityShows the severity in the label ("Allergy: Penicillin (Severe)"); default false
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus