shadcn.io is not affiliated with official shadcn/ui
Input Group examples · Buttons
Password Actions Input Group for React
A password input with a show/hide button and a generate button at its end.
The two actions a password field usually needs. The eye button switches the input between password and text, and its label says what it will do; the refresh button is the place to generate a strong password. Both are ghost icon buttons in inline-end addons after the input.
Preview
Installation
FAQ
How does the eye button show the password?
A visible flag sets the input's type to text or password, and the icon to an open or crossed-out eye.
What does the toggle say to screen readers?
Its aria-label follows the flag: Show password while hidden, Hide password while shown.
What does the generate button do?
Nothing in the demo. Generate a password in its handler and write it into the field, which then needs to be a controlled input.
In what order do the buttons appear?
In source order: the show/hide addon, then the generate addon, both with align="inline-end" after the input.
Related
- Copy Button Input GroupA read-only link with a copy button that
- Multiple Action Buttons Input GroupA read-only link with an info button and
- Search Button Input GroupA search input with a labeled Search
- Password Strength Validation FormA password that needs 8 characters with
- Required Field InputA required field with an asterisk in its
- Input with LabelA text input with a label above it