Skip to content

BaseChipsInput

Base Chips Input component with drop down and autocomplete functionality

Props

Prop nameDescriptionTypeValuesDefault
listlist of selectable options. needs to be a list with at least an identifier and a label
(properties can be set via identifierPropertyName and labelPropertyName)
array-[]
modelValuelist of already selected options, displayed as chips
needs to be a list with at least an identifier and a label
(properties can be set via identifierPropertyName and labelPropertyName)
array-[]
inputTypespecify input field typestringtext, search'text'
labelinput field labelstring-
showLabeldefine if label should be visibleboolean-true
placeholderinput field placeholderstring-null
dropDownNoOptionsInfomessage displayed when no selectable options are availablestring-'No options available'
allowUnknownEntriesdefine if the user can add an option that is not in the listboolean-false
allowMultipleEntriesdefine only a single or multiple options can be selectedboolean-true
allowDynamicDropDownEntriesdefine if selectable list options should be fetched every time or if the
list passed in the beginning is used
boolean-false
showInputBorderoption to have the border of the input field not displayedboolean-true
sortableif true a button with that functionality will be visibleboolean-false
draggabledefine if chips should be draggable (currently only available for inline)boolean-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-''
addNewChipTextset a chips text for adding a new chip.
(alternatively add a form.Add value to your localization files)
if allowUnknownEntries is true please add this in one form or another!
string-''
inputIdif field is occuring more then once - set an idstring-''
identifierPropertyNamespecify the object property that should be used as identifierstring-'id'
labelPropertyNamespecify the object property that should be used as value to be displayedstring-'label'
displayChipsInlineproperty for special case in 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 attribute)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-false
clearableif true a remove icon (or a custom icon if slot remove-icon is used) will be shown allowing to remove
all input at once
for an example see BaseInput
boolean-false
inputClassspecify additional input field stylingstring-''
chipsEditableset 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
closeDropdownOnOptionSelectset true if dropdown should be closed after selecting an optionboolean-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
resultsRetrieved: text that is announced when results were retrieved (drop down
list changed)
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',
resultsRetrieved: '{number} options in drop down.',
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 iconboolean-true
defaultEntrydefine a default entry
will be added when component is mounted and selected list is initially empty
properties:
label|* string: the label of the default option - use the property name set via prop labelPropertyName
id|* string?: (optional) identifier of the default option - use the property name set via prop identifierPropertyName
object|null-null
highlightStringMatchset this flag to true to highlight autocomplete option characters that match
the current search input string

caveat: setting this variable true can lead to XSS attacks. Only use
this prop on trusted content and never on user-provided content.
boolean-false
highlightStringTagsif highlightAutocompleteMatch is set true
provide tag names to style the matched characters
(without '<' and '>', e.g. ['b'] for <b>)
array-[]
interpretChipsLabelAsHtmlif necessary selected 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.
boolean-false

Events

Event namePropertiesDescription
update:model-valueundefined Object[] - the altered selectedListinform parent of changes to selected list
fetch-dropdown-entriesvalue string - the input string
type string - the labelPropertyName that was specified
event to fetch drop down entries with changing input

Slots

NameDescriptionBindings
drop-down-entrya slot to provide more advanced drop down entries per default only the Object[labelPropertyName][?lang] will be displayeditem Object - the option passed to options list
no-optionsa slot to customize messages in case of no options present in drop down
below-inputto add elements below input fields e.g. add drop down
label-additionSlot to allow for additional elements on the right side of the label row <div> (e.g. language tabs)). for an example see BaseChipsInputField
pre-input-fieldslot to add elements within the form field but in a row before the actual input field. for an example see BaseChipsInputField
input-field-addition-beforeSlot to allow for additional elements in the input field &lt;div&gt; (before <input>). for an example see BaseChipsInputField
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 BaseChipsInputField
input-field-addition-afterfor adding elements after input
post-input-fieldfor adding elements at the end covering the whole height. for an example see BaseChipsInputField
error-iconuse a custom icon instead of standard error/warning icon. for an example see BaseChipsInputField.
remove-iconuse a custom icon instead of standard remove icon. for an example see BaseChipsInputField.

Demo

Simple Single Choice Example with fixed dropdown, no unknown, not draggable

Additionally, to the custom events listed above also all native input events are available.

Multiple Entries Example with fixed dropdown, no unknown and draggable