Skip to content
Theme:

Ui3nInput ​

Text input component with validation, icons, states, and various customization options.

Props

NameTypeDefaultDescription
idstring | undefined —

Root element id

modelValue*string""

Input value

labelstring | undefined""

Input label

type"text" | "password" | undefined"text"

Input type

size"regular" | "large" | undefined"regular"

Input field size (height)

placeholderstring | undefined""

Input placeholder

clearableboolean | undefinedfalse

Whether input is clearable

autofocusboolean | undefinedfalse

Whether input is autofocus

readonlyboolean | undefinedfalse

Whether input is readonly

namestring | undefined —

Input name attribute (for use in native forms)

maxlengthnumber | undefined —

Maximum length of input value

minlengthnumber | undefined —

Minimum length of input value

autocompletestring | undefined"off"

Autocomplete attribute

rules((v: unknown) => string | boolean)[] | undefined[]

Validation rules

validateAtStartupboolean | undefinedfalse

Whether to validate at startup

hideBottomSpaceboolean | undefinedfalse

Whether to hide bottom space

displayStateMode"error" | "success" | undefined —

Display state mode

displayStateWithIconboolean | undefinedfalse

Whether to display state with icon

displayStateMessagestring | undefined""

Display state message

disabledboolean | undefinedfalse

Whether input is disabled

maskFactoryArg —

IMask options applied to the input. Works only with `type="text"`.

maskValueModeUi3nInputMaskValueMode | undefined"masked"

Which value is emitted through `update:modelValue`, `input` and `change` and passed to the validation rules.

Events

Event NameArguments / Value TypeDescription
update:modelValuevalue: string —
clear —
entervalue: { value: string; altKey: boolean; ctrlKey: boolean; shiftKey: boolean; metaKey: boolean; } —
initvalue: HTMLInputElement —
focusvalue: Event —
blurvalue: Event —
changevalue: string —
inputvalue: string —
keydownvalue: KeyboardEvent —
update:validvalue: boolean —
escapevalue: Event —

Slots

Slot NameScope Props (v-slot)Description
#prepend-icon —

Slot for prepend icon (displayed at the start of the input)

#append-icon —

Slot for append icon (displayed at the end of the input)

Public Methods & Exposes

Method NameSignature / TypeDescription
inputElement()HTMLInputElement | null

Reference to the input DOM element

isDirty()boolean

Whether the input has been modified

isFocused()boolean

Whether the input is currently focused

clearValue()() => void

Clear the input value

CSS Variables

Set any of these where you need it — on :root, on a container, or on the element itself through [data-ui3n] — and the component follows. Leave them alone and it uses the defaults below.

NameDefault
--ui3n-input-bg-colorvar(--color-bg-control-secondary-default)
--ui3n-input-bg-disabled-colorvar(--color-bg-control-secondary-disabled)
--ui3n-input-bg-focused-colorvar(--color-bg-control-secondary-focused)
--ui3n-input-bg-hover-colorvar(--color-bg-control-secondary-hover)
--ui3n-input-border-radius4px
--ui3n-input-border-radius-largevar(--ui3n-input-border-radius, 8px)
--ui3n-input-disabled-colorvar(--color-text-control-secondary-disabled)
--ui3n-input-error-colorvar(--error-content-default)
--ui3n-input-font-size13px
--ui3n-input-font-size-largevar(--ui3n-input-font-size, 16px)
--ui3n-input-height32px
--ui3n-input-height-largevar(--ui3n-input-height, 48px)
--ui3n-input-label-colorvar(--color-text-control-primary-default)
--ui3n-input-label-font-size12px
--ui3n-input-message-font-size10px
--ui3n-input-message-topcalc(var(--_input-height) + 16px + 2px)
--ui3n-input-outer-padding-bottom15px
--ui3n-input-outer-padding-top1px
--ui3n-input-outer-padding-x1px
--ui3n-input-outline-focused-colorvar(--color-border-control-accent-focused)
--ui3n-input-padding-x8px
--ui3n-input-padding-x-largevar(--ui3n-input-padding-x, 12px)
--ui3n-input-placeholder-colorvar(--color-text-control-secondary-default)
--ui3n-input-placeholder-hover-colorvar(--color-text-control-secondary-hover)
--ui3n-input-success-colorvar(--success-content-default)
--ui3n-input-text-colorvar(--color-text-control-primary-default)

Usage Examples ​

Basic usage ​

Basic usage

Simple input with v-model and placeholder

Label and sizes ​

Label and sizes

Input with label and different sizes: regular and large

Clearable input ​

Clearable input

Input with clear button using the clearable prop

Icon slots ​

Icon slots

Using prepend-icon and append-icon slots

Validation and states ​

Validation and states

Input validation with rules and display states (success, error)

Looks good!
This field has an error

Disabled and readonly ​

Disabled and readonly

Input in disabled and readonly states

Events ​

Events

Input events: input, change, enter, focus, blur, clear, escape

No events yet. Interact with the input above.

Input mask ​

Input mask

IMask-powered input masks: masked model (phone) and unmasked model (time)

v-model:
v-model: