Skip to main content

Icon

BasicData display<co-icon>

Icon draws one of the inline 24px stroke icons used across CareOS, at stroke width 2 in the current text colour.

import { Icon } from 'health-components';

Examples​

All Icons​

Storybook

Sizes​

Storybook

With a label (meaningful alone)​

Storybook

Usage​

<Icon name="lock" size={14} />
<Icon name="alert" label="Critical" />

When to use​

  • Next to a label in buttons, menus, tags and banners; alone only inside IconButton.

When not to use​

  • Decoration in empty space; emoji.

Variants and states​

VariantWhat it is
sizes12, 14, 16 (default), 18, 20, 22, 26.
stroke2 by default; 3 inside small filled dots.
labelledlabel gives role img and aria-label; otherwise aria-hidden.

Accessibility​

  • Icons that carry meaning on their own need label; icons beside text are hidden.
  • Icons that carry meaning need 3:1 against their ground.

Do and don't​

  • Do: Lock icon plus words in every read-only state.
  • Don't: Mixing filled and outline icon sets.

Props​

PropTypeDefaultDescription
name *IconName—Icon name, one of `Icon.names`.
sizenumber16Size in px
strokeWidthnumber2Stroke width
labelstring—Makes the icon meaningful to screen readers (role img). Without it the icon is decorative and hidden.

Also accepts native attributes, including type, max, min, plus className and event handlers on the root element.

Angular, Vue and HTML​

Register the elements once (Angular guide), then use <co-icon>. 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-icon name="…" size="…" [max]="max"></co-icon>
KindNameDescription
attributenameIcon name, one of `Icon.names`.
attributesizeSize in px; default 16
attributestroke-width / strokeWidthStroke width; default 2
attributelabelMakes the icon meaningful to screen readers (role img). Without it the icon is decorative and hidden.
attributetype
property / JSON attributemax
property / JSON attributemin