passwordField defines a field for entering passwords. Characters typed into this field are masked by default.

For the login page, consider using a dedicated loginForm component that prompts a user password as a part of the authentication process.
  • XML element: passwordField

  • Java class: JmixPasswordField


The set of attributes of passwordField is similar to textField except there is no datatype attribute. The input for passwordField can only be of type String.

Basic passwordField example:

<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() == false)
        notifications.create("Password created")
password field basic



Determines whether to prevent entering individual characters that don’t match the regular expression in the setAllowedCharPattern() method. Set to true to restrict invalid characters. Set to false to ignore the restriction.


Defines the value of passwordField.

If the value cannot be parsed to String, the default conversion error message appears.


To generate a handler stub in Jmix Studio, use the Handlers tab of the Jmix UI inspector panel or the Generate Handler action available in the top panel of the view class and through the CodeGenerate menu (Alt+Insert / Cmd+N).


com.vaadin.flow.component.textfield.GeneratedVaadinTextField.ChangeEvent corresponds to the change DOM event.


com.vaadin.flow.component.textfield.GeneratedVaadinTextField.InvalidChangeEvent is sent when the value of the invalid attribute of the component changes.


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 && String.valueOf(value).length() < 8)
        throw new ValidationException("Password must be at least 8 characters long");


See Also

See Vaadin Docs for more information.