Fragiola

Fields

Password Input

A password with a button that shows and hides it, the control only its middle inside the field's row.

npx shadcn@latest add @fragiola/password-input
Password Input
Gallery

A password input hides what is typed until its trigger shows it. The trigger is a toggle button (aria-pressed, aria-controls the input) whose name is yours and does not change with the state (aria-label="Show password"). The input keeps the focus on a press, the selection survives the change of type, and the text is hidden again on submit and on reset. visible, defaultVisible and onVisibleChange hold the state.

The field's middle

It goes in a Field.Row, which draws the box: Root is the control's area (field.body), Input the bare control (field.control), and VisibilityTrigger a small ghost Clickable at the inline end, with the eye while hidden and the crossed eye while shown, unless you give it children.

Bases

Primitives-backed. Base UI has no password input, so this is one shared file (ui/password-input.tsx) that wraps Fragiola Primitives' PasswordInput on both bases, and the item depends on @fragiola/[email protected] on both.

On Base UI, the registry's Field is Base UI's and does not reach a Fragiola Primitives control: give the Root an id and the label htmlFor, as the example does (it works on both bases), and pass name, required and disabled to the Root. On Fragiola Primitives the input is also a Field control.

Parts

PartSource
Rootprimitive PasswordInput.Root + field.body()
Inputprimitive PasswordInput.Input + field.control()
VisibilityTriggerprimitive PasswordInput.VisibilityTrigger + clickable()