Skip to content

BaseChipsInputField

input field with chips functionalities

Props

Prop nameDescriptionTypeValuesDefault
inputIdif field is occurring more than once - set an idstring-''
selectedListlist of selected options (strings or objects - set isStringArray true if it is an array of strings),
displayed as chips
(you can use the v-model directive on this property)
array-[]
modelValueinput stringstring-''
inputTypespecify input field typestringtext, search'text'
labelinput field labelstring-
showLabeldefine if label should be visibleboolean-true
placeholderinput field placeholderstring-null
allowUnknownEntriesdefine if the user can add an option that is not in the listboolean-true
allowMultipleEntriesdefine only a single or multiple options can be selectedboolean-true
addSelectedEntryDirectlythis means typed input will be added as chip directlyboolean-false
sortableif true a button with that functionality will be visibleboolean-false
draggabledefine if chips should be draggableboolean-false
alwaysLinkeddefine if entries should always appear linked (-> with grey background)boolean-false
isLoadingshow spinner to indicate that something is loading
(for dynamically fetched entries that need to do backend requests)
boolean-false
sortTextif sorting is enabled this will be the text shown in the buttonstring-'Sort A – Z'
sortNameif true sorting will consider the last string in a label or if a comma is
present the string before the comma
boolean-false
languageset a language (ISO 639-1)string-''
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
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
identifierPropertyNamespecify the object property that should be used as identifierstring-''
labelPropertyNamespecify the object property that should be used as value to be displayedstring-'label'
isStringArrayspecify true if selectedList array is a array of stringsboolean-false
displayChipsInlineproperty for special case component BaseChipsBelow - if false in this case chips will
not be displayed in the input field
boolean-true
requiredmark as required field (currently only used for aria-required)boolean-false
invalidmark the form field as invalid and ideally also provide an error message
to display below the form field
for an example see BaseInput
boolean-false
disabledset true if input field should be disabled
for an example see BaseInput
boolean-false
errorMessageadd an error message to be displayed below form field if field is invalid
for an example see BaseInput
string-''
showErrorIcondefine if error icon should be shown
for an example see BaseInput
boolean-true
clearableif true a remove icon will be shown allowing to remove
all input at once
for an example see BaseInput
boolean-false
loadableif true space is reserved for a loader that can be activated
with the 'isLoading' prop
boolean-false
isActivepossibility to steer input field active state from outside
it is possible to use the v-model directive here
boolean-false
inputClassspecify additional input field stylingstring-''
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
chipsEditabledefine true if chip should be editable on click
caveat: this will only work if prop allowUnknownEntries is also set true
also setting this prop true will disable the dragging functionality (also see prop
draggable)
boolean-false
assistiveTextthis prop gives the option to add assistive text for screen readers
properties:

selectedOption: text read when a selected option is focused (currently only
working for editable chips)
loaderActive: text that is announced when results are being fetched (prop
isLoading is set true)
clearInput: text read for remove input icon if prop clearable is set true
optionAdded: text read when option was added to the selected list. string {label}
could be added to be replaced by the actual chip label (value in [labelPropertyName])
optionToRemoveSelected: text read when option is marked active for removal (by using
backspace in empty input field). string {label} could be added to be replaced
by the actual chip label (value in [labelPropertyName])
optionRemoved: text read when option was removed from the selected list. string {label}
could be added to be replaced by the actual chip label (value in [labelPropertyName])
object-{
selectedOption: '',
loaderActive: 'loading.',
clearInput: 'Clear input',
optionAdded: 'option {label} added to selected list.',
optionToRemoveSelected: 'option {label} from selected list marked for removal. Press delete or backspace to remove.',
optionRemoved: 'option {label} removed.'
}
chipsRemovabledefine if selected options chips should come with a remove icon
(usually desired usability wise just an additional option for allowMultipleEntries
false if there is any other means of removal
(e.g. BaseAdvancedSearch))
boolean-true
interpretChipsLabelAsHtmlif necessary chip text can
be rendered as v-html directive

caveat: setting this variable true can lead to XSS attacks. Only use
this prop on trusted content and never on user-provided content. This is
also why this will only take effect on selected chips with identifier (=selected
from the options not a direct user input)
boolean-false

Events

Event namePropertiesDescription
update:selected-listundefined (Object[], String[]) - the modified list - arrayinform parent of changes to selected option list
(you can use the v-model directive on prop selectedList)
duplicateundefined Object - the option with the identical valueemitted when user was trying to add an option but there was already
an option with the same value in the list of selected options
removedevent emitted if option is removed from the list of selected
options (additionally to altered list in case parent needs to know
which item was removed)
update:model-valueundefined string - the new input stringemitting the input string if changed internally
update:is-activeundefined boolean - is input field activeevent updating the is-active prop in case of internal changes

Slots

NameDescriptionBindings
label-additionSlot to allow for additional elements on the right side of the label row <div> (e.g. language tabs))
pre-input-fieldslot to add elements within the form field but in a row before the actual input field. for an example see BaseInput
input-field-addition-beforeSlot to allow for additional elements in the input field <div> (before <input>)
chipa slot to provide customized chipsentry object - one selected option displayed as chip
index number - the index of the entry in the selectedList array
indexActiveForRemove number - the index of the chip that is currently active to be removed (for keyboard handling)
removeEntry function - function to remove the entry from selectedList, needs entry and index as arguments
input-field-inline-beforeto add elements directly inline before the input (contrary to input-field-addition-before this does not wrap). for an example see BaseInput
input-field-addition-afterfor adding elements after input
post-input-fieldfor adding elements at the end covering the whole height
error-iconuse a custom icon instead of standard error/warning icon
remove-iconuse a custom icon instead of standard remove icon
below-inputbelow-input slot added to e.g. add drop down

Demo

Simple chips input field example stand alone.

Additionally, to custom events, this component also has all events available emitted by the native input element (e.g. focus or blur events).

Also try to drag or sort the chips!

Example using the 'chip' slot with all props provided by the slot. Click the chip or use backspace to remove it.

Also see one more example in combination with a BaseDropDownList.