Skip to main content

DevDrawer

ComplexDeveloper<co-dev-drawer>

DevDrawer is the "For developers" panel every screen has: purpose and roles, API, fields, states and entry points.

import { DevDrawer } from 'health-components';

Examples​

Showcase​

Storybook

All Sections​

Storybook

Open From Button​

Storybook

Usage​

<Button iconLeft="code" onClick={() => setDev(true)}>For developers</Button>
{dev && <DevDrawer screen="Claims" purpose="..." api="GET /claims?status=rejected" onClose={() => setDev(false)} />}

When to use​

  • Every screen, opened from the "For developers" button in the page header.

When not to use​

  • User help text.

Variants and states​

VariantWhat it is
sectionsOnly the props you pass are shown, in a fixed order.

Accessibility​

  • As Drawer.

Do and don't​

  • Do: Say what a check catches and what it does not.
  • Don't: Put secrets or real PHI in examples.

Props​

PropTypeDefaultDescription
screen *string—Screen name; the title reads "For developers: <screen>". Required
purpose *string—Purpose and roles: what the screen does and who uses it. Required
rolesstringnoneRoles and access
apistringnoneAPI calls and payloads, shown in mono
fieldsstringnoneFields and which are required
statesstringnoneStates the screen can be in
entrystringnoneEntry points: where the screen is opened from
widthnumber560Panel width in px
openbooleantrueWhether the drawer is shown
onClose() => voidnoneCalled by the x button, Escape and a scrim press
inlinebooleanfalseRender in place for docs: no portal, focus trap, scroll lock or Escape

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-dev-drawer>. 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-dev-drawer screen="…" purpose="…" [defaultValue]="defaultValue" (co-close)="onClose($event.detail)"></co-dev-drawer>
KindNameDescription
attributescreenScreen name; the title reads "For developers: <screen>". Required
attributepurposePurpose and roles: what the screen does and who uses it. Required
attributerolesRoles and access; default none
attributeapiAPI calls and payloads, shown in mono; default none
attributefieldsFields and which are required; default none
attributestatesStates the screen can be in; default none
attributeentryEntry points: where the screen is opened from; default none
attributewidthPanel width in px; default 560
attributeopenWhether the drawer is shown; default true
attributeinlineRender in place for docs: no portal, focus trap, scroll lock or Escape; default false
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus
eventco-closeCalled by the x button, Escape and a scrim press; default none (React: onClose)