Taginput
A simple tag input field that can have autocomplete functionality
Examples
Base
Show code
Autocomplete
Show code
Custom selected
Show code
Limits
Show code
Variants
Show code
Class props
Taginput component
A simple tag input field that can have autocomplete functionality
html
<o-taginput></o-taginput>
Props
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
allowAutocomplete | Add autocomplete feature (if true, any Autocomplete props may be used too) | boolean | - | false |
allowDuplicates | Allows adding the same item multiple time | boolean | - | false |
allowNew | When autocomplete, it allow to add new items | boolean | - | false |
ariaCloseLabel | Accessibility label for the close button | string | - | From config: taginput: { |
autocomplete | Native options to use in HTML5 validation | string | - | From config: taginput: { |
beforeAdding | Function to validate the value of the item before adding | (value: T | string) => boolean | - | Default function (see source code) |
checkScroll | Makes the component check if list reached scroll start or end and emit scroll events. | boolean | - | From config: taginput: { |
closable | Add close/delete button to the item | boolean | - | From config: taginput: { |
closeIcon | Icon name of close icon on selected item | string | - | From config: taginput: { |
confirmKeys | Array of keys (https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values) which will add a item when typing | string[] | - | From config: taginput: { |
counter | Show counter when maxlength or maxtags props are passed | boolean | - | From config: taginput: { |
createItem | Function to create a new item to push into v-model (items) | (value: T | string) => T | - | Default function (see source code) |
data | Items data | T[] | - | Default function (see source code) |
disabled | Same as native input disabled | boolean | - | false |
expanded | Makes input full width when inside a grouped or addon field | boolean | - | false |
field | Property of the object (if data is array of objects) to use as display text | string | - | "value" |
groupField | Property of the object (if data is array of objects) to use as display text of group | string | - | |
groupOptions | Property of the object (if data is array of objects) to use as key to get items array of each group | string | - | |
icon | Icon to be shown | string | - | From config: taginput: { |
iconPack | Icon pack to use | string | mdi , fa , fas and any other custom icon pack | From config: taginput: { |
keepFirst | The first option will always be pre-selected (easier to just hit enter or tab) | boolean | - | false |
keepOpen | Keep open dropdown list after select | boolean | - | From config: autocomplete: { |
maxitems | Limits the number of items, plus item counter | string|number | - | |
maxlength | Same as native maxlength, plus character counter | string|number | - | |
openOnFocus | Opens a dropdown with choices when the input field is focused | boolean | - | false |
override | Override existing theme classes completely | boolean | - | |
placeholder | Input placeholder | string | - | |
removeOnKeys | Allow removing last item when pressing given keys, if input is empty | string[] | - | From config: taginput: { |
separators | Array of chars used to split when pasting a new string | string[] | - | From config: taginput: { |
size | Vertical size of the input control | string | small , medium , large | From config: taginput: { |
teleport | Append the component to another part of the DOM. Set true to append the component to the body.In addition, any CSS selector string or an actual DOM node can be used. | boolean|string|object | - | From config: taginput: { |
useHtml5Validation | Enable html 5 native validation | boolean | - | From config: { |
v-model | T[] | - | Default function (see source code) | |
validationMessage | The message which is shown when a validation error occurs | string | - | |
variant | Color of the each item | string | primary , info , success , warning , danger , and any other custom color | From config: taginput: { |
Events
Event name | Properties | Description |
---|---|---|
scroll-start | the list inside the dropdown reached the start | |
scroll-end | the list inside the dropdown reached it's end | |
icon-click | event Event - native event | on icon click event |
icon-right-click | event Event - native event | on icon right click event |
update:modelValue | value (string | number | object)[] - updated modelValue prop | modelValue prop two-way binding |
input | value String - input value | on input change event |
add | value string | number | object - added item | new item got added |
remove | value string | number | object - removed item | item got removed |
focus | event Event - native event | on input focus event |
blur | event Event - native event | on input blur event |
invalid | event Event - native event | on input invalid event |
Slots
Name | Description | Bindings |
---|---|---|
selected | Override selected items | items unknown[] - selected items |
header | Define an additional header | |
default | Override the select option | option object - option objectindex number - option indexvalue unknown - option value |
empty | Define content for empty state | |
footer | Define an additional footer | |
counter | Override the counter | items number - items counttotal number - total count |
Sass variables
Current theme ➜ Oruga Base
SASS Variable | Default |
---|---|
$taginput-background-color | $input-background-color |
$taginput-height | calc(2em - 1px) |
$taginput-padding | calc(0.275em - 1px) 0 0 |
$taginput-border-color | $grey-lighter |
$taginput-border-style | solid |
$taginput-border-width | 1px |
$taginput-border-radius | $base-border-radius |
$taginput-color | #363636 |
$taginput-line-height | $base-line-height |
$taginput-box-shadow | inset 0 1px 2px hsla(0, 0%, 4%, 0.1) |
$taginput-max-width | 100% |
$taginput-width | 100% |
$taginput-counter-font-size | 0.75rem |
$taginput-counter-margin | 0.25rem 0 0 0.5rem |
$taginput-item-background-color | $primary |
$taginput-item-color | $primary-invert |
$taginput-item-border-radius | $base-border-radius |
$taginput-item-margin | 0 0 0 0.275em |
$taginput-item-padding | 0 0.75em 0 0.75em |
$taginput-margin-icon-to-text | 0.1875em |
See ➜ 📄 Full scss file
Current theme ➜ Oruga Full
SASS Variable | Default |
---|---|
$taginput-background-color | $input-background-color |
$taginput-height | calc(2em - 1px) |
$taginput-padding | calc(0.275em - 1px) 0 0 |
$taginput-border-color | $grey-lighter |
$taginput-border-style | solid |
$taginput-border-width | 1px |
$taginput-border-radius | $base-border-radius |
$taginput-color | #363636 |
$taginput-line-height | $base-line-height |
$taginput-box-shadow | inset 0 1px 2px hsla(0, 0%, 4%, 0.1) |
$taginput-max-width | 100% |
$taginput-width | 100% |
$taginput-counter-font-size | 0.75rem |
$taginput-counter-margin | 0.25rem 0 0 0.5rem |
$taginput-item-background-color | $primary |
$taginput-item-color | $primary-invert |
$taginput-item-border-radius | $base-border-radius |
$taginput-item-margin | 0 0 0 0.275em |
$taginput-item-padding | 0 0.75em 0 0.75em |
$taginput-margin-icon-to-text | 0.1875em |
See ➜ 📄 Full scss file
Current theme ➜ Bulma
The theme does not have any custom variables for this component.
Current theme ➜ Bootstrap
SASS Variable | Default |
---|---|
$taginput-badge-bg | $light |
$taginput-badge-color | $dark |
$taginput-badge-font-size | 0.9em |
$taginput-badge-margin | 0.25em |
$taginput-badge-icon-space | 0.25em |
$taginput-counter-margin | 0.25rem 0 0 0.5rem |
$taginput-counter-font-size | 0.75rem |
See ➜ 📄 Full scss file