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
All Sections
Open From Button
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
| Variant | What it is |
|---|---|
| sections | Only 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
| Prop | Type | Default | Description |
|---|---|---|---|
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 |
roles | string | none | Roles and access |
api | string | none | API calls and payloads, shown in mono |
fields | string | none | Fields and which are required |
states | string | none | States the screen can be in |
entry | string | none | Entry points: where the screen is opened from |
width | number | 560 | Panel width in px |
open | boolean | true | Whether the drawer is shown |
onClose | () => void | none | Called by the x button, Escape and a scrim press |
inline | boolean | false | Render 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>
| Kind | Name | Description |
|---|---|---|
| attribute | screen | Screen name; the title reads "For developers: <screen>". Required |
| attribute | purpose | Purpose and roles: what the screen does and who uses it. Required |
| attribute | roles | Roles and access; default none |
| attribute | api | API calls and payloads, shown in mono; default none |
| attribute | fields | Fields and which are required; default none |
| attribute | states | States the screen can be in; default none |
| attribute | entry | Entry points: where the screen is opened from; default none |
| attribute | width | Panel width in px; default 560 |
| attribute | open | Whether the drawer is shown; default true |
| attribute | inline | Render in place for docs: no portal, focus trap, scroll lock or Escape; default false |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus | |
| event | co-close | Called by the x button, Escape and a scrim press; default none (React: onClose) |