Forms

Password

A password field with the usual defaults filled in: named password, labelled "Password", autocomplete="current-password", the label as placeholder, and a button that shows and hides what was typed. It is a tk:input of type password.

Blade

A "Password" label over a masked input with "Password" as placeholder and an eye button at the end. Inside a Livewire component with a $password property, the field is bound to it. Password managers offer the saved password.

New password #

autocomplete="new-password" makes password managers offer a generated password instead of a saved one. Every default except type can be replaced on the tag; with wire:model or x-model the default name is the bound property.

At least 8 characters.

Blade

The labelAppend slot puts content after the label, such as a link to reset the password.

Blade

Without the eye button #

viewable set to false removes the show-password button.

Blade

Icon and size #

The field control props of tk:input work here too: icon, size, help.

Used to unlock your saved cards.

Blade

Viewed event #

Clicking the eye button fires viewed with { viewed } in the detail, whether the password is now shown.

Shown:
Blade

Customization #

viewable: attributes go to the show-password button and input:class to the <input>.

Blade

Reference

tk:password

Takes every prop of tk:input and the field props. Its defaults:

Prop / attribute Default
name password
type password
autocomplete current-password
placeholder true (the label)
viewable true

Slots

The named slots of tk:input (the default slot is not used), such as labelAppend for a "Forgot your password?" link:

blade

Customization

As tk:input, including viewable: for the show-password button.

blade

Accessibility

A labelled <input type="password">. The show-password button has a name and aria-pressed, and switching it changes only the input's type, so the value and the focus stay.

Behavior notes

  • Old input from a failed submit never fills a password field.
  • A shown password is hidden again when its form is submitted, so password managers can still save it.