The input allows users to enter single-line or multi-line text. Its styling and behavior reproduce the WinUI 3 (Windows App SDK) TextBox and PasswordBox: the three-line template (header / control / description), the elevated stroke with bottom highlight, the password reveal button with the Alt+F8 shortcut, and the mask character and password reveal modes are all checked against the source line by line.
The password form has two mask paths, and the trade-off is described in Password Box: without passwordChar it uses the native browser type="password" (keeping the "password field" semantics for password managers / IMEs / screen readers, with the mask glyph determined by the browser); with passwordChar it uses a "display buffer" mask (glyph-accurate, but the field is type="text" in masked state, so screen readers and password managers no longer recognize it as a password field).
Bind a string value with v-model; events and native attributes (autocomplete, maxlength, aria-describedby…) pass through directly to the internal <input> / <textarea>.
Current value: (empty)
size takes small (24px) / medium (32px, default) / large (40px). The WinUI TextBox only has the 32px tier; the size tiers are an extension of this library. The header and description font sizes follow the selected size tier.
appearance takes outline (default, WinUI's "elevated stroke": light on top / left / right and heavy on the bottom edge) or underline (only the bottom edge remains; a library extension).
header renders above the control (WinUI TextBox.Header, with an 8px bottom margin), and description renders below the control (TextBox.Description, with the foreground taken from TextFillColorSecondary). They respectively become the source of the input's aria-labelledby / aria-describedby, and can also be replaced with same-named slots; when consumers explicitly pass aria-label / aria-describedby, they are not overridden.
The title renders as the element pointed to by aria-labelledby and the description is attached to aria-describedby; both default texts can be overridden with named slots.
multiline corresponds to WinUI TextBox.AcceptsReturn = true + TextWrapping = Wrap and renders a <textarea>: its height expands by rows (default 3), with the lower bound being the size tier height (WinUI MinHeight 32), and the bottom-right corner can be dragged to adjust the height.
invalid is a library extension (the WinUI TextBox has no built-in error state): it switches to the status-danger stroke and renders aria-invalid, and the bottom highlight also uses danger when focused.
Please enter a valid value.
type="password" corresponds to the WinUI PasswordBox:
passwordChar: native <input type="password">. The mask glyph is determined by the browser (Chrome / Firefox draw •, while WinUI uses ●) — this is an unavoidable difference on the Web, but in exchange password managers, autofill, IME composition, and the screen-reader "password field" role all keep working as normal.passwordChar (the first code point is used when multiple characters are given): uses the "display buffer" mask, structurally isomorphic to WinUI handing the plaintext to the RichEdit password mode — the field contains the masked string, and the true value only lives in the component state, with each edit inferring the true value from the visible difference. The glyph matches the specified character exactly, at the cost that the field is type="text" in that state: screen readers no longer treat it as a password field, and the browser no longer offers password saving / filling.WinUI rule: the reveal button appears only after focus, and only after typing has begun from empty during that focus. The password box above is prefilled — clear it and type again to see the button; the one below (the native masking path) has no prefilled content, so typing shows it immediately.
Copy interception (applies to both paths): in the masked state
copy/cut/dragstartare all intercepted (the "Copy" entry in the context menu,Ctrl+Cafter selection, and dragging text all cannot retrieve the content), corresponding to WinUI's password mode offering no clipboard outlet and the text control'sTXTBIT_DISABLEDDRAG. When the plaintext is shown (peekwhile held, orvisible) copying is allowed — consistent with the "the eye-closed mode blocks copying" behavior.
Browser-measured differences between the two paths: the native path (no
passwordChar) is atype="password"control whose mask glyph is the browser's•; the display-buffer path (withpasswordChar) is atype="text"control whose mask glyph is the specified character (the#in the example). The editing behavior of both paths has been verified item by item in a real browser: insert in the middle / backspace in the middle / replace selection / paste /Ctrl+Zundo /Ctrl+Shift+Zredo / the true value after select-all-and-delete all match the input (given the same mask glyph, the true value is inferred from thebeforeinputedit range +inputType, not from glyph comparison).
passwordRevealMode corresponds to WinUI PasswordBox.PasswordRevealMode:
| Value | Behavior |
|---|---|
'peek' | Default. A "show" button appears on the right when focused + "empty → non-empty" during the current focus + the control width is wider than 5em; while held, the plaintext is shown and released immediately re-masks it. The keyboard equivalent is holding Alt + F8 (releasing F8 re-masks) |
'hidden' | Always masked, no button appears |
'visible' | Always shows plaintext, no button appears (the official sample uses a CheckBox to toggle between hidden / visible) |
A few details from the WinUI source (all guarded by contract tests): the button has tabindex="-1" (IsTabStop=False) and does not enter the Tab sequence; on focus the button is hidden first and only appears once content has been typed from empty during the current focus; the button does not appear when the control width is less than 5em (the Minimum width … is 5em in ArrangeOverride).
The third variant of the official WinUI sample: `passwordRevealMode` is switched between `hidden` and `visible` by the consumer, so the built-in “Show” button does not appear (mutually exclusive with `peek`).
| Prop (Props) | Type | Default | Description |
|---|---|---|---|
modelValue | string | — | Input value (v-model) |
size | 'small' | 'medium' | 'large' | 'medium' | Size, with heights of 24 / 32 / 40 px respectively (WinUI default is 32) |
appearance | 'outline' | 'underline' | 'outline' | Appearance; outline matches WinUI's "elevated stroke", underline is a library extension (only the bottom edge remains) |
disabled | boolean | false | Whether the input is disabled |
invalid | boolean | false | Invalid / error state; a library extension (the WinUI TextBox has no built-in error state), also renders aria-invalid |
type | 'text' | 'password' | 'email' | 'number' | 'search' | 'tel' | 'url' | 'text' | Native type (ignored when multiline is true) |
placeholder | string | — | Placeholder |
header | string | — | Header, rendered above the control (WinUI TextBox.Header); also used as the accessible-name source |
description | string | — | Description, rendered below the control (WinUI TextBox.Description), attached to aria-describedby |
multiline | boolean | false | Multiline form (WinUI AcceptsReturn + TextWrapping=Wrap), renders a <textarea> |
rows | number | 3 | Number of multiline rows (only takes effect with multiline) |
passwordRevealMode | 'peek' | 'hidden' | 'visible' | 'peek' | Password reveal mode (WinUI PasswordBox.PasswordRevealMode, only takes effect with type="password") |
passwordChar | string | — | Mask character (WinUI PasswordBox.PasswordChar); without it the native type="password" is used, with it the display-buffer mask is used (see Password Box) |
revealButtonLabel | string | 'Show password' | Accessible name of the "show" button (corresponds to the WinUI localized string UIA_PASSWORDBOX_REVEAL) |
| Slot (Slots) | Description |
|---|---|
header | Replaces the header content (WinUI HeaderTemplate) |
description | Replaces the description content |
No extra Events:
modelValue/update:modelValueare provided byv-model; native events such asinput/change/focus/blur/keydownand attributes such asautocomplete,maxlength,aria-*fall through directly to the internal<input>/<textarea>, so they can be passed as with a native field.
Two known Web-side differences (both written into the component comments, not claimed as "aligned with real hardware"): ① with native
type="password"the mask glyph is determined by the browser and WinUI's●cannot be specified; to specify a glyph you must use the display-buffer path (passwordChar), at the cost that screen readers / password managers no longer recognize the password field. ② With an explicitpasswordChar, WinUI disables the IME in password mode (InputScope = IS_PASSWORD); the Web cannot disable the IME, so during IME composition-webkit-text-securityis used to mask the plaintext, and the content is converged back into the masked string once composition ends.