LockedField
ComplexAccess
<co-locked-field>LockedField is a read-only field for the View access level: value visible and copyable, lock icon and "Your role can view but not edit".
import { LockedField } from 'health-components';
Examples
Messages
Usage
<LockedField label="Member ID" value="W123456789" message="Needs Edit coverage" />
When to use
- Any field the role can read but not change.
When not to use
- Fields the role must not see: do not render (None).
Variants and states
| Variant | What it is |
|---|---|
| default | Standard message. |
| custom message | Name the permission. |
Accessibility
- aria-describedby links the lock line.
Do and don't
- Do: Keep value selectable.
- Don't: Use disabled grey with no reason.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label * | string | — | Visible label; required |
value * | string | — | Value shown, selectable and copyable; required |
message | string | "Your role can view but not edit" | Lock line under the field (name the missing permission) |
style | CSSProperties | — | Inline style of the root |
size | TextFieldSize | 'md' | 'sm' 30px | 'md' 36px | 'lg' 48px (kiosk) |
iconLeft | IconName | none | Icon inside the input on the left |
helper | string | the mask hint | Muted hint under the field |
suffix | string | none | Unit text inside the input on the right, such as "units" |
Also accepts native attributes, including defaultChecked, autoFocus, onInput, type, disabled, name, max, step, placeholder, accept, autoComplete, checked, maxLength, min, multiple, plus className and event handlers on the root element.
Angular, Vue and HTML
Register the elements once (Angular guide), then use <co-locked-field>. 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-locked-field label="…" value="…" [style]="style" (co-input)="onInput($event.detail)"></co-locked-field>
| Kind | Name | Description |
|---|---|---|
| attribute | label | Visible label; required |
| attribute | value | Value shown, selectable and copyable; required |
| attribute | message | Lock line under the field (name the missing permission); default "Your role can view but not edit" |
| attribute | default-checked / defaultChecked | |
| attribute | auto-focus / autoFocus | |
| property / JSON attribute | style | Inline style of the root |
| property / JSON attribute | type | |
| attribute | disabled | |
| attribute | name | |
| attribute | size | 'sm' 30px | 'md' 36px | 'lg' 48px (kiosk); default 'md' |
| property / JSON attribute | max | |
| property / JSON attribute | step | |
| attribute | icon-left / iconLeft | Icon inside the input on the left; default none |
| attribute | placeholder | |
| attribute | accept | |
| property / JSON attribute | auto-complete / autoComplete | |
| attribute | checked | |
| attribute | max-length / maxLength | |
| property / JSON attribute | min | |
| attribute | multiple | |
| attribute | helper | Muted hint under the field; default the mask hint |
| attribute | suffix | Unit text inside the input on the right, such as "units"; default none |
| event | co-input | (React: onInput) |