Skip to main content

EmptyState

BasicData display<co-empty-state>

EmptyState fills a screen or card that has nothing to show, including the access-denied screen.

import { EmptyState } from 'health-components';

Examples​

Showcase​

Storybook

Empty​

Storybook

Denied​

Storybook

Load Error​

Storybook

Usage​

<EmptyState kind="noresults" title="No patients match" actions={<Button>Clear Filters</Button>}>Try the MRN or date of birth.</EmptyState>

When to use​

  • No data yet, no search results, no access, load failed.

When not to use​

  • A table with filters applied: use the table empty row.

Variants and states​

VariantWhat it is
emptyInbox icon, what will appear here, first action.
noresultsSearch icon, how to widen the search.
deniedLock icon, the missing permission and who can grant it.
errorRed circle, what failed and Try Again.
compact24px padding, inside cards.

Accessibility​

  • denied and error use role alert.

Do and don't​

  • Do: Denied: name the permission ("Manage claims") and the person (Practice Admin).
  • Don't: "Oops!"
  • Don't: Hiding the screen from the menu and then showing a denied page from a link: same rule both places.

Props​

PropTypeDefaultDescription
kindEmptyStateKind'empty''empty' | 'noresults' | 'denied' | 'error'
title *ReactNode—Heading (h2). Required
childrenReactNodenoneBody text: what to do next
actionsReactNodenoneButtons under the body
iconIconNameby kind (inbox, search, lock, alert-circle)Icon
compactbooleanfalseLess padding, for cards and table bodies

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-empty-state>. 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-empty-state kind="…" icon="…" [defaultValue]="defaultValue">…</co-empty-state>
KindNameDescription
attributekind'empty' | 'noresults' | 'denied' | 'error'; default 'empty'
attributeiconIcon; default by kind (inbox, search, lock, alert-circle)
attributecompactLess padding, for cards and table bodies; default false
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus
slottitleHeading (h2). Required Plain text also works as the `title` attribute.
slot(default)Body text: what to do next; default none
slotactionsButtons under the body; default none Plain text also works as the `actions` attribute.