Skip to main content

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​

Storybook

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​

VariantWhat it is
defaultStandard message.
custom messageName 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​

PropTypeDefaultDescription
label *string—Visible label; required
value *string—Value shown, selectable and copyable; required
messagestring"Your role can view but not edit"Lock line under the field (name the missing permission)
styleCSSProperties—Inline style of the root
sizeTextFieldSize'md''sm' 30px | 'md' 36px | 'lg' 48px (kiosk)
iconLeftIconNamenoneIcon inside the input on the left
helperstringthe mask hintMuted hint under the field
suffixstringnoneUnit 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>
KindNameDescription
attributelabelVisible label; required
attributevalueValue shown, selectable and copyable; required
attributemessageLock line under the field (name the missing permission); default "Your role can view but not edit"
attributedefault-checked / defaultChecked
attributeauto-focus / autoFocus
property / JSON attributestyleInline style of the root
property / JSON attributetype
attributedisabled
attributename
attributesize'sm' 30px | 'md' 36px | 'lg' 48px (kiosk); default 'md'
property / JSON attributemax
property / JSON attributestep
attributeicon-left / iconLeftIcon inside the input on the left; default none
attributeplaceholder
attributeaccept
property / JSON attributeauto-complete / autoComplete
attributechecked
attributemax-length / maxLength
property / JSON attributemin
attributemultiple
attributehelperMuted hint under the field; default the mask hint
attributesuffixUnit text inside the input on the right, such as "units"; default none
eventco-input (React: onInput)