Capítulo 24 de 43
A password <input> paired with a built-in visibility-toggle button, handling the fiddly focus-management and security details (auto-hide on submit) that a hand-rolled show/hide password button usually gets wrong.
unstable_PasswordToggleField — API may still change.Root → Input + Toggle (→ Icon or Slot for the visible/hidden glyph).Input; toggling with keyboard/virtual navigation keeps focus on the Toggle button itself — deliberately different per input modality.Icon vs Slot: Icon takes visible/hidden React nodes directly; Slot is the lower-level primitive, also accepting a render function for full control (e.g. animating between two SVG paths).<PasswordToggleField.Root>
<PasswordToggleField.Input />
<PasswordToggleField.Toggle>
<PasswordToggleField.Icon visible={<EyeOpenIcon />} hidden={<EyeClosedIcon />} />
</PasswordToggleField.Toggle>
</PasswordToggleField.Root>
Toggle buttons get implicit accessible labeling automatically — no extra aria-label wiring needed for the common case.Slot + render instead of Icon when you need something beyond a simple two-state icon swap (e.g. an animated path transition).unstable_-prefixed form-input primitive from the same family.