Customization
Icons, text, props, automatic hiding, autoComplete and locked states.
Icons & text
icons takes any ReactNode: show renders while the password is hidden, hide while it is visible.
inputProps & btnProps
Toggled 0 times
Merge rules: useViraPassword().
Automatic hiding
Hiding on submit lets password managers see a password field when they save. Automatic hiding works even while the field is disabled.
useViraPassword({
hideOnSubmit: true, // default: hide on form submit and reset
hideOnBlur: true, // hide when focus leaves the field or the tab is hidden
})autoComplete
useViraPassword() // current-password (login)
useViraPassword({ policy }) // new-password (sign-up)
useViraPassword({ autoComplete: "one-time-code" })
useViraPassword({ autoComplete: false }) // no attributedisabled & readOnly
The toggle is locked while the field is disabled.