Props
| Name | Description |
|---|---|
append:icon Type: string | Name of the icon to be added at the end of the input. The append icon position shows one thing at a time, by priority: clear button, then spinner, then the error or warning icon, then this. On a |
autocomplete Type: string | Guides to the browser as to the type of information expected in the field. Set it on every field in an auth or checkout flow. Search and filter boxes need |
autofocus Type: Booleanish | Focuses the field when it mounts (a dialog already open included), unless the user is typing in another field. The replacement for the template-ref API v3 removed: there is no exposed |
clearable Type: booleanDefaultall.clearable (false) | Displays a clear button when the input has a value and is being interacted with. There is no |
compact Type: boolean | Compact density: the field uses the A property of a view, not of a field. Two densities in one form read as a seam. See example |
counter Type: booleanDefaultfalse | Shows a character count at the end of the hint row: |
description Type: string | Text between the label and the input. Unlike the hint it is always visible; it joins the input's Always visible, and read before typing: the place for an instruction. |
disabled Type: booleanDefaultfalse | Disables the component. Blocks the keyboard too, so a disabled value is unreachable for someone navigating that way. Prefer |
emitMasked Type: booleanDefaultfalse | Emits the masked value of the input. Off by default, so the model holds the digits while the field shows the separators. Turn it on when the formatted string is the value you store, and do not strip formatting server-side that was never sent. See example |
errors Type: string | string[] | Error messages under the field, a string or array, in an A non-empty value implies the error state, so |
formless Type: booleanDefaultfalse | Keep this control out of the enclosing For a field inside a |
hasErrors Type: booleanDefaultfalse | Define if the component should be in an error state. It usually attaches a CSS class for styling purposes. Sets |
hasWarnings Type: booleanDefaultfalse | Define if the component should be in a warning state. Same chrome as errors with The warning counterpart of |
hideLabel Type: booleanDefaultfalse | Visually hides the label of the input while maintaining accessibility. Pair it with a Keeps the accessible name and removes only the visible text. It is the answer for a search box that shows just a placeholder; omitting |
hint Type: string | Text box to be displayed near the input, usually to indicate instructions. Shown while the field has focus, unless |
id Type: string | The |
inputAlign Type: FieldCrossAlign | Vertical position of the control in a side-by-side row; not |
inputMode Type: "text" | "search" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | The inputmode of the input. Steers the mobile keyboard independently of |
items Type: T[] | ((context: BbTextInputItemsContext) => T[] | Promise<T[]>) | Suggestions while typing (autocomplete): a list, or a provider called with what was typed. The typed text stays the value; a pick writes the suggestion's text. Not with |
itemText Type: ItemAccessor<T, string>Defaultown label, else text | The text of an object suggestion: a key, a dot path, or a function. Unset: own |
label requiredType: string | Text content of the label of the element. Required, and display and accessibility only: it does not set the |
labelAlign Type: FieldCrossAlign | Vertical position of the label block in a side-by-side row; not |
labelMode Type: "outside" | "floating" | "inside" | Label rendering mode. A bare |
labelPosition Type: "end" | "start" | "center" | "left" | "right"Default'start' | Text alignment of the label. |
layout Type: Responsive<FieldLayout> | How label and input sit together: Applies only while the resolved label mode is |
loading Type: booleanDefaultfalse | Sets the component in a loading state, usually triggering some visual styles. Visual only: the field stays editable. If the value must not change while an async check runs, write that guard yourself and tag requests so a stale response cannot overwrite a newer one. See example |
mask Type: MaskInputOptions | A maska options object, not a string: A maska config, live-reactive: changing the options reformats the current value. Masks format, they do not validate: a complete-but-wrong value still needs an error. See example |
minQueryLength Type: numberDefaultcomponents.BbTextInput.minQueryLength, else 1 | Characters (trimmed) before the suggestions search, as on BbSelect; below it (a cleared field included) the suggestions close and nothing is called.
|
modelValue Type: string | null | Used by v-model. |
name Type: string | Defines the name of the input. Unset, the rendered |
nullValue Type: 'null' | 'string' | What the field emits once emptied (typing, the clear button, an empty mask): |
persistentHint Type: booleanDefaultfalse | Keeps the hint displayed. |
placeholder Type: string | Text shown while the field is empty. |
prefix Type: string | Text in the box before the value ( Plain text at the inner edge of the box, beside the value and never part of it. Affixes never take focus, so a click here lands in the input: a small button belongs in |
prepend:icon Type: string | Name of the icon to be added at the start of the input. |
pt Type: (PtCompoundOf<"", { readonly parts: readonly ["root", "label", "description", "message", "hint", "box", "input", "icon", "spinner", "prefix", "suffix", "clear", "counter"]; readonly states: readonly ["hasValue", "nearLimit", "atLimit", ...("disabled" | "loading" | "errors" | "warnings" | "readonly" | "hasValue")[]]; readonly wide: readonly ["hasValue", "nearLimit", "atLimit", "readonly", "disabled", "warnings", "errors", "loading"]; readonly except: { readonly clear: readonly ["disabled", "readonly"]; }; readonly variant: { readonly names: readonly ["outline", "secondary", "ghost"]; readonly option: "textInputVariants"; readonly parts: readonly ["root", "label", "description", "message", "hint", "box", "input", "icon", "spinner", "prefix", "suffix", "clear"]; }; }> & { input?: PtValue | undefined; label?: PtValue | undefined; prefix?: PtValue | undefined; root?: PtValue | undefined; icon?: PtValue | undefined; "root:disabled"?: PtValue | undefined; "icon:disabled"?: PtValue | undefined; spinner?: PtValue | undefined; clear?: PtValue | undefined; "root:loading"?: PtValue | undefined; "icon:loading"?: PtValue | undefined; "spinner:loading"?: PtValue | undefined; "clear:loading"?: PtValue | undefined; "root:errors"?: PtValue | undefined; "root:warnings"?: PtValue | undefined; "root:readonly"?: PtValue | undefined; "spinner:disabled"?: PtValue | undefined; description?: PtValue | undefined; message?: PtValue | undefined; hint?: PtValue | undefined; "label:disabled"?: PtValue | undefined; "label:errors"?: PtValue | undefined; "label:warnings"?: PtValue | undefined; "label:readonly"?: PtValue | undefined; "icon:errors"?: PtValue | undefined; "icon:warnings"?: PtValue | undefined; "icon:readonly"?: PtValue | undefined; "description:disabled"?: PtValue | undefined; "description:errors"?: PtValue | undefined; "description:warnings"?: PtValue | undefined; "description:readonly"?: PtValue | undefined; "message:disabled"?: PtValue | undefined; "message:errors"?: PtValue | undefined; "message:warnings"?: PtValue | undefined; "message:readonly"?: PtValue | undefined; "hint:disabled"?: PtValue | undefined; "hint:errors"?: PtValue | undefined; "hint:warnings"?: PtValue | undefined; "hint:readonly"?: PtValue | undefined; "label:loading"?: PtValue | undefined; "label:hasValue"?: PtValue | undefined; "root:hasValue"?: PtValue | undefined; "icon:hasValue"?: PtValue | undefined; "description:loading"?: PtValue | undefined; "description:hasValue"?: PtValue | undefined; "message:loading"?: PtValue | undefined; "message:hasValue"?: PtValue | undefined; "hint:loading"?: PtValue | undefined; "hint:hasValue"?: PtValue | undefined; box?: PtValue | undefined; suffix?: PtValue | undefined; "input:disabled"?: PtValue | undefined; "input:loading"?: PtValue | undefined; "input:errors"?: PtValue | undefined; "input:warnings"?: PtValue | undefined; "input:readonly"?: PtValue | undefined; "input:hasValue"?: PtValue | undefined; "prefix:disabled"?: PtValue | undefined; "prefix:loading"?: PtValue | undefined; "prefix:errors"?: PtValue | undefined; "prefix:warnings"?: PtValue | undefined; "prefix:readonly"?: PtValue | undefined; "prefix:hasValue"?: PtValue | undefined; "spinner:errors"?: PtValue | undefined; "spinner:warnings"?: PtValue | undefined; "spinner:readonly"?: PtValue | undefined; "spinner:hasValue"?: PtValue | undefined; "clear:errors"?: PtValue | undefined; "clear:warnings"?: PtValue | undefined; "clear:hasValue"?: PtValue | undefined; "box:disabled"?: PtValue | undefined; "box:loading"?: PtValue | undefined; "box:errors"?: PtValue | undefined; "box:warnings"?: PtValue | undefined; "box:readonly"?: PtValue | undefined; "box:hasValue"?: PtValue | undefined; "suffix:disabled"?: PtValue | undefined; "suffix:loading"?: PtValue | undefined; "suffix:errors"?: PtValue | undefined; "suffix:warnings"?: PtValue | undefined; "suffix:readonly"?: PtValue | undefined; "suffix:hasValue"?: PtValue | undefined; counter?: PtValue | undefined; "input:nearLimit"?: PtValue | undefined; "input:atLimit"?: PtValue | undefined; "label:nearLimit"?: PtValue | undefined; "label:atLimit"?: PtValue | undefined; "prefix:nearLimit"?: PtValue | undefined; "prefix:atLimit"?: PtValue | undefined; "root:nearLimit"?: PtValue | undefined; "root:atLimit"?: PtValue | undefined; "icon:nearLimit"?: PtValue | undefined; "icon:atLimit"?: PtValue | undefined; "spinner:nearLimit"?: PtValue | undefined; "spinner:atLimit"?: PtValue | undefined; "description:nearLimit"?: PtValue | undefined; "description:atLimit"?: PtValue | undefined; "message:nearLimit"?: PtValue | undefined; "message:atLimit"?: PtValue | undefined; "hint:nearLimit"?: PtValue | undefined; "hint:atLimit"?: PtValue | undefined; "box:nearLimit"?: PtValue | undefined; "box:atLimit"?: PtValue | undefined; "suffix:nearLimit"?: PtValue | undefined; "suffix:atLimit"?: PtValue | undefined; "counter:disabled"?: PtValue | undefined; "counter:loading"?: PtValue | undefined; "counter:errors"?: PtValue | undefined; "counter:warnings"?: PtValue | undefined; "counter:readonly"?: PtValue | undefined; "counter:hasValue"?: PtValue | undefined; "counter:nearLimit"?: PtValue | undefined; "counter:atLimit"?: PtValue | undefined; "clear:nearLimit"?: PtValue | undefined; "clear:atLimit"?: PtValue | undefined; } & { "root:outline"?: PtValue | undefined; "icon:outline"?: PtValue | undefined; "root:secondary"?: PtValue | undefined; "icon:secondary"?: PtValue | undefined; "spinner:outline"?: PtValue | undefined; "spinner:secondary"?: PtValue | undefined; "clear:outline"?: PtValue | undefined; "clear:secondary"?: PtValue | undefined; "root:ghost"?: PtValue | undefined; "icon:ghost"?: PtValue | undefined; "spinner:ghost"?: PtValue | undefined; "label:outline"?: PtValue | undefined; "description:outline"?: PtValue | undefined; "message:outline"?: PtValue | undefined; "hint:outline"?: PtValue | undefined; "input:outline"?: PtValue | undefined; "input:secondary"?: PtValue | undefined; "input:ghost"?: PtValue | undefined; "label:secondary"?: PtValue | undefined; "label:ghost"?: PtValue | undefined; "prefix:outline"?: PtValue | undefined; "prefix:secondary"?: PtValue | undefined; "prefix:ghost"?: PtValue | undefined; "clear:ghost"?: PtValue | undefined; "description:secondary"?: PtValue | undefined; "description:ghost"?: PtValue | undefined; "message:secondary"?: PtValue | undefined; "message:ghost"?: PtValue | undefined; "hint:secondary"?: PtValue | undefined; "hint:ghost"?: PtValue | undefined; "box:outline"?: PtValue | undefined; "box:secondary"?: PtValue | undefined; "box:ghost"?: PtValue | undefined; "suffix:outline"?: PtValue | undefined; "suffix:secondary"?: PtValue | undefined; "suffix:ghost"?: PtValue | undefined; }) | Passthrough, object form: |
pt:<part> Type: PtValue | Passthrough, attribute form: one attribute per part, |
queryDebounceTime Type: numberDefaultcomponents.BbTextInput.queryDebounceTime, else 500 | Time to wait when the user stops writing before the provider is called. The component owns the debounce; a hand-rolled one around the function fights it. An app-wide default goes in |
readonly Type: booleanDefaultfalse | Sets the input in a readonly state. Keeps the value focusable, selectable and copyable while refusing edits: the right choice for a value the user did not set but may need to read or copy. See example |
required Type: booleanDefaultfalse | Sets the native Outside a |
reverse Type: boolean | Reverses the layout. Applicable in every direction the order of the label and the input is swapped. |
rules Type: RuleExpression<string | null> | vee-validate rules for this field. Only inside a Read only inside a |
suffix Type: string | Text in the box after the value ( |
type Type: "text" | "search" | "tel" | "url" | "email" | "password"Default"text" | Type of the input. Restricted to the textual input types this component supports — use Narrowed in v3 to the text-like types. |
validationLabel Type: string | The field's name in validation messages ( |
validationMode Type: ValidationMode | When the field validates: |
variant Type: InputVariantOf<TextInputVariantRegistry>Default'outline' | The field box's look, with |
warnings Type: string | string[] | Warning messages under the field, a string or array: amber, in their own The amber channel, for a value that is accepted and still worth a second look. Unlike |
v-model
Values kept in sync through v-model.
| Name | Description |
|---|---|
modelValue Type: string | null |
|
Events
| Name | Description |
|---|---|
blur Type: (event: FocusEvent): void | Emitted when the native input loses focus. Forwards the original DOM |
change Type: (event: Event): void | Emitted when the native input fires a change event. Forwards the original DOM The native DOM event, on blur or Enter. To save, listen to |
click Type: (event: MouseEvent): void | Emitted when the input receives a click interaction. Forwards the original DOM |
compositionend Type: (event: CompositionEvent): void | Emitted when a composition session ends (e.g. CJK IME confirmed). Forwards the original DOM |
compositionstart Type: (event: CompositionEvent): void | Emitted when a composition session starts (e.g. CJK IME begins). Forwards the original DOM |
focus Type: (event: FocusEvent): void | Emitted when the native input gains focus. Forwards the original DOM |
input Type: (event: Event): void | Emitted on native input events from the text field. Forwards the original DOM |
keydown Type: (event: KeyboardEvent): void | Emitted for keyboard interaction on the input. Forwards the original DOM |
keyup Type: (event: KeyboardEvent): void | Emitted when a key is released over the input. Forwards the original DOM |
mousedown Type: (event: MouseEvent): void | Emitted when a pointing device button is pressed over the input. Forwards the original DOM |
mouseup Type: (event: MouseEvent): void | Emitted when a pointing device button is released over the input. Forwards the original DOM |
option:selected Type: (item: T): void | A suggestion was picked (with The whole item the user picked, for the id behind the text. The text stays the value, so typing on is free text again and emits nothing: keep the item only while the text still matches it. See example |
paste Type: (event: ClipboardEvent): void | Emitted when content is pasted into the input. Forwards the original DOM |
update:modelValue Type: (value: string | NullValueOf<E>): void | Emitted when the value changes. Carries the new string, or the empty value ( |
value-commit Type: (value: string | NullValueOf<E>): void | Emitted when the user commits the text: where the native The hook for saving: once per finished edit, never for a value your code writes. See example |
Slots
The listed properties are the ones exposed to the slot scope.
| Name | Description |
|---|---|
append Type: object | Content rendered after the text input, at the end of the field box. |
append:outer Type: object | Content rendered after the entire text input control, outside the input chrome. Outside the field chrome, and the only affix position that may hold something interactive. See example |
description Type: BbTextInputDescriptionSlotProps | Replaces the description text. Provided alone (no |
hint Type: BbTextInputDescriptionSlotProps | Replaces the hint text; alone it still renders the row. May hold an action. Can hold an action, such as a button that fills the field. See example |
item Type: { item: T; text: string; focused: boolean; } | One suggestion's row (autocomplete, with |
label Type: BbTextInputLabelSlotProps | Replaces the default label text rendered above the input. Receives |
prefix Type: object | Inline content rendered at the start of the input field area, before the typed text. For more than text, such as an icon or a styled token. It wins over the |
prepend Type: object | Content rendered before the text input, at the start of the field box. |
prepend:outer Type: object | Content rendered before the entire text input control, outside the input chrome. |
suffix Type: object | Inline content rendered at the end of the input field area, after the typed text. See example |
Renamed and removed
Names from v2 and from earlier 3.0 betas that no longer work, and what to write instead.
- slot
append-outerappend:outerfails silently - method
blurremovedfails silentlyNo template-ref API in v3. Reach the <input> through pt:
:pt="{ input: { attrs: { ref: (el) => (input = el) } } }", theninput.blur()on that element;autofocusfor focus on mount. directionlayoutfails silently- method
focusremovedfails silentlyNo template-ref API in v3. Reach the <input> through pt:
:pt="{ input: { attrs: { ref: (el) => (input = el) } } }", theninput.focus()on that element;autofocusfor focus on mount. hasWarninghasWarningsfails silently- slot
prepend-outerprepend:outerfails silently - method
selectremovedfails silentlyNo template-ref API in v3. Reach the <input> through pt:
:pt="{ input: { attrs: { ref: (el) => (input = el) } } }", theninput.select()on that element;autofocusfor focus on mount. validateOnvalidationModefails silentlyAn array of events became one mode (
aggressive|balanced|lazy|submit-only|submit-live). The old defaults (['blur'],['inactive'], a toggle's['update:modelValue', 'change', 'blur']) arebalanced, the new default: delete the prop. A text field on['update:modelValue']isvalidation-mode="aggressive". Set it once on<BbForm validation-mode>instead of per field.vidremovedfails silentlyA display name (v2:
vid="Email address") is nowvalidation-label; a field path (3.0 betas:vid="address.city") is nowname(brackets for a native post:address[city]).check --fixpicks by the value.