Password fieldPro
A password input whose reveal button slashes the eye with a drawn line, with a Caps Lock warning and a reveal that hides itself again.
oxyn add password-fieldThe preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.
Rendered from Rust at build time · goes live when visible
When to use
- Sign in, unlock a vault, paste an API secret.
- The user wants to check what they typed without leaving it on screen and to know when Caps Lock is fighting them.
When not to use
- A new-password field with a four-segment meter, a rule checklist with remaining counts and a strength word that morphs up or down: use Password strength instead.
- One input for every form: use Text Field instead.
- The verification-code field: use OTP Input instead.
Installation
Password field is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.
oxyn add password-fieldUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Default
Label, description and reveal.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Timed
Hides again after 10 s (Oxyn plus).
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Vault
Fill from the vault (Oxyn plus).
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Error
Wrong password.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
PasswordField
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | String | — | Label. |
description | Option<String> | Default::default() | Helper copy (linked through aria-describedby). |
value | String | Default::default() | Starting value. |
placeholder | Option<String> | Default::default() | Placeholder. |
autocomplete | String | "current-password" | `current-password` · `new-password`. |
name | Option<String> | Default::default() | Form field name. |
required | bool | Default::default() | Required. |
error | Option<String> | Default::default() | Error. |
show_label | String | "Show password" | Toggle name when hidden. |
hide_label | String | "Hide password" | Toggle name when shown. |
caps_warning | bool | true | Oxyn plus: warn when Caps Lock is on. |
reveal_for | Option<u32> | Default::default() | Oxyn plus: hide again after this many seconds. |
vault | bool | Default::default() | Oxyn plus: a "Use saved password" button (the host fills from its vault). |
disabled | bool | Default::default() | Disabled. |
on_input | EventHandler<String> | — | Changed. |
on_vault | EventHandler<()> | — | Vault button pressed. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| EnterorSpace | On the toggle: show or hide the password |
| Tab | Input, then the vault button, then the toggle |
Accessibility
- The toggle is a native button with aria-pressed, aria-controls and a label that switches Show / Hide password.
- The description (and the Caps Lock warning) is linked with aria-describedby.
- autocomplete current-password / new-password so password managers work.
From the spec
Native button with aria-pressed, aria-controls and a label that flips between Show and Hide password. The description or Caps warning is linked through aria-describedby. Never announce the password itself.
Motion & interaction
The eye never swaps icons: a single slash draws across it (with a background-coloured mask so it reads on any surface) and undraws when revealed. The value resolves through a short fade on each toggle so the switch between dots and text isn't a jump.
Timing
| Transition | Duration | Easing | Reduced motion |
|---|---|---|---|
| Slash draw / undraw | 180 ms | ease.out (cubic) | instant |
| Value resolve | 160 ms | ease.out | instant |
| Caps warning in | 180 ms | ease.out | swap |
| Timed hide (Oxyn plus) | reveal_for s | — | same |
Responsive behaviour
- Fills its column; the reveal button sits inside the shell and never wraps.
- Hover styles only on fine pointers.
Edge cases (spec)
Very long secrets scroll inside the input; the toggle never wraps. Password managers keep working (real type=password input, autocomplete). Caps detection uses the typed letter and Shift, so it works where getModifierState is missing. RTL: the toggle sits at the inline end.
Notes for AI
- Import
PasswordFieldfromoxyn_dioxusand includePRIMITIVES_CSSplus the token stylesheet once. - A GPUI version exists:
PasswordFieldElinoxyn_gpui. - Props to set first:
label. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.