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
Sizes
With a label (meaningful alone)
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
| Variant | What it is |
|---|---|
| sizes | 12, 14, 16 (default), 18, 20, 22, 26. |
| stroke | 2 by default; 3 inside small filled dots. |
| labelled | label 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
| Prop | Type | Default | Description |
|---|---|---|---|
name * | IconName | — | Icon name, one of `Icon.names`. |
size | number | 16 | Size in px |
strokeWidth | number | 2 | Stroke width |
label | string | — | 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>
| Kind | Name | Description |
|---|---|---|
| attribute | name | Icon name, one of `Icon.names`. |
| attribute | size | Size in px; default 16 |
| attribute | stroke-width / strokeWidth | Stroke width; default 2 |
| attribute | label | Makes the icon meaningful to screen readers (role img). Without it the icon is decorative and hidden. |
| attribute | type | |
| property / JSON attribute | max | |
| property / JSON attribute | min |