Skip to content

BaseInput

Form Input Field Component

Props

Prop nameDescriptionTypeValuesDefault
modelValueinput field settable from outsidestring|number-''
labellabel for input field, required for usability purposes, handle
showing of label with property showLabel
string-
showLabeldefines if input label should be visibleboolean-true
inputIdif field is occurring more then once - set an id
caveat: in case a custom input is used with the input slot it is important to
assign the same id to the input element
string-''
placeholderset a placeholder for the input fieldstring-'Enter Text Here'
requiredmark as required fieldboolean-false
invalidmark the form field as invalid and ideally also provide an error message
to display below the form field
the v-model directive might be used on this prop
boolean-false
errorMessageadd an error message to be displayed below form field if field is invalidstring-''
showErrorIcondefine if error icon should be shownboolean-true
inputTypespecify input typestringtext, number, password, email, url, search'text'
dropDownListIdspecify the id of a linked drop down liststring-''
linkedListOptionspecify a linked list option (e.g. drop down)
(will be used in aria-activedescendant attribute)
number|string-null
hideInputFieldoption to hide input field from outside (required for chips input)boolean-false
isActiveset input field in active state from outside
the v-model directive can be used on this prop
boolean-null
showInputBorderoption to have the border of the input field not displayedboolean-true
useFormFieldStylingdefine if standard form field styling should be
used (otherwise no border, no box shadow)
boolean-true
clearableif true a remove icon (or custom icon if slot remove-icon is used) will be shown allowing to remove
all input at once
boolean-false
loadableif true space is reserved for a loader that can be activated
with the isLoading prop
boolean-false
isLoadingshow spinner to indicate that something is loading
(for dynamically fetched entries that need to do backend requests)
boolean-false
useFadeOutturn off input fade out if it interferes with other styling (e.g. with custom input)boolean-true
inputClassspecify additional input field stylingstring-''
languageset a language (ISO 639-1)string-''
setFocusOnActiveuse this prop to deactivate automatic setting of focus as soon as input element
becomes active - this might require external handling of focus setting!
boolean-true
disabledset true if input field should be disabledboolean-false
minLengthset min length of charactersnumber-null
maxLengthset max length of charactersnumber-null
decimalsset number of decimals (inputType=number)<br>
Note: -1 is used for endless decimals
number-null
decimalSeparatorset decimal separator character, e.g. ',' for german
note that this only changes the display of decimal values, input
values should always be provided with '.' as separator and will be
returned as such
string-'.'
minset minimum value to acceptnumber-null
maxset maximum value to acceptnumber-null
validationTextsdefine validation messages
currently just for type number
object-{
min: 'Value must be greater than or equal to {value}.',
max: 'Value must be less than or equal to {value}.',
minLength: 'Text must be at least {value} character(s) long.',
maxLength: 'Text cannot be longer than {value} characters.'
}
assistiveTextprovide assistive text for screen readers
loaderActive: if loadable is set true this text is read
as soon as the loader is appearing (isLoading is set true)
clearInput: text read for remove input icon if prop clearable is set true
object-{
loaderActive: 'loading.',
clearInput: 'Clear input'
}
ignoreClickOutsideadd queryselector strings for elements that should not trigger a
click outside event
array-[]

Events

Event namePropertiesDescription
clicked-outside
click-input-field
update:invalidval boolean - undefinedpropagate invalid state changes of input field to parent
update:is-active
update:model-valueundefined union - the validated input valueEvent emitted on input, passing input string

Slots

NameDescriptionBindings
label-additionSlot to allow for additional elements on the right side of the label row <div> (e.g. language tabs))
pre-input-fieldadd elements before the actual input line but within the input field container
input-field-addition-beforeSlot to allow for additional elements in the input field <div> (e.g. chips) (before <input>)
input-field-inline-beforeto add elements directly inline before the input (contrary to input-field-addition-before this does not wrap
inputreplace native HTML input element with custom inputid string - the id of the BaseInput component - if id is not provided in props this is an internal id that should also be set as <input> id. Also if this slot is used the v-model value should be provided to BaseInput as well for validation. Otherwise validation can be triggered with the validate() method.
remove-iconuse a custom icon instead of standard remove icon
input-field-addition-afterfor adding elements after input (e.g. used to add loader)
error-iconuse a custom icon instead of standard error/warning icon
post-input-fieldafter the actual input element over whole height of the input field container
below-inputbelow-input slot added to e.g. add drop down

Demo

A simple example without label

A example with label and slot demonstrations. Also enter text to see clearable state or toggle controls to see various properties such as invalid state and the below-input slot. Also it is demonstrated here how to use the isActive prop.

All events emitted by the native input element (e.g. @keydown) contained in the BaseInput component are also available.