Skip to main content

PasswordInput

The PasswordInput component can be used to hide user input. Always use a PasswordInput when your app asks for sensitive data, such as a password. Users can click on the eye icon to hide or show their data.

Import

import { PasswordInput } from '@dynatrace/strato-components/forms';

Demo

This is the simplest version of the PasswordInput, which is uncontrolled and therefore handles its state internally. You can also set a specific initial value using the defaultValue prop.

Control state

The PasswordInput can also be controlled, meaning that you can handle the state. To do so, you need to use the onChange prop to provide a handler that is called when the internal state of the input changes. You also need to assign the value from the state to the PasswordInput by setting the value prop.

Customize tooltip text

You can use the PasswordInput.Tooltip to customize the text displayed if the password input text is either shown or hidden.

Validation

For validation patterns including custom hints and errors, see show custom hints and errors in the FormField documentation.

Still have questions?
Find answers in the Dynatrace Community