Skip to content

Password input ​

A password field with an inline reveal toggle that stays out of the tab order.

Open in demo
Open in demo

Usage ​

v-model is the password string. The component declares only the five props below and forwards every other attribute to the inner input, so required, minlength, name, disabled and the rest work as they do on a plain field.

The eye is tabindex="-1". Tab from the field goes to the next field, not to the toggle, because the reveal is a convenience and tabbing into it on the way to Sign in would be a detour on every attempt.

Examples ​

Invalid ​

ariaInvalid puts aria-invalid on the field, which is what draws the error ring. Pair it with aria-describedby, which falls through to the field with every other attribute.

Disabled ​

disabled is not a declared prop. It falls through to the inner field like any other attribute.

API ​

Source: src/shared/components/common/SaPasswordInput.vue

Props ​

PropTypeDefaultDescription
idstring—Put on the field, so a <Label for> points at it.
modelValuestring—The password.
placeholderstring—The field's placeholder.
ariaInvalidboolean—Sets aria-invalid on the field.
autocompletestring—Passed to the field. Use current-password to sign in and new-password to set one.

inheritAttrs is off and every other attribute is bound onto the inner field rather than the wrapper.

Emits ​

EventPayloadDescription
update:modelValuevalue: stringFires on input.

Slots ​

None.

Accessibility ​

  • The toggle is named "Show password" or "Hide password" as its state changes, and carries aria-pressed.
  • The toggle is out of the tab order, so it never sits between the field and the submit button. A screen reader still reaches it in browse mode.
  • The icon flips between an open and a struck-through eye, so the state does not rest on color.
  • aria-describedby and the rest fall through to the field, which is where an error message has to be announced from.