A field for entering passwords. Characters typed into this field are masked by default.

The loginForm component includes a password input field, where users can enter their password as they log in.
  • XML element: passwordField

  • Java class: JmixPasswordField


The following example demonstrates basic passwordField functionality:

<passwordField id="passwordField"
               label="New password"
               helperText="Make it strong!">
<button id="createPasswordButton"
protected JmixPasswordField passwordField;
protected Notifications notifications;

protected void onButtonClick(ClickEvent<Button> event) {
    if (!passwordField.getValue().isEmpty())
        notifications.create("Password created")
password field basic

The set of attributes for the passwordField component is similar to the attributes available for the textField component. However, there is no datatype attribute – the input for a passwordField can only be of type String.


Чтобы сгенерировать заглушку обработчика в Jmix Studio, используйте вкладку Handlers панели инспектора Jmix UI, или команду Generate Handler, доступную на верхней панели контроллера экрана и через меню CodeGenerate (Alt+Insert / Cmd+N).


Adds a validator instance to the component. The validator must throw ValidationException if the value is not valid.

@Install(to = "passwordField", subject = "validator")
private void passwordFieldValidator(String value) {
    if (value != null && value.length() < 8)
        throw new ValidationException("Password must be at least 8 characters long");



Adds a prefix component inside the field, typically an icon.

        <icon icon="KEY"/>
password field prefix


Adds a suffix component inside the field, typically an icon. The Show password button remains visible.

        <icon icon="KEY"/>
password field suffix

See Also

See Vaadin Docs for more information.