To have autocomplete functionality, add the autocomplete
prop. You can add any prop from Autocomplete API.
Taginput
A simple tag input field that can have autocomplete functionality
# Autocomplete
Tags:[]
# Templated Autocomplete
Slots are available for autocomplete items and the empty message, like with the Autocomplete control.
Tags:[]
# Custom selected
You can have a custom template by adding selected
scoped slot to it.
Tags:[]
# Limits
You can limit the length and number of tags with the maxlength
and maxtags
props. Maxlength counter is only shown when typing.
# States
You can change the input type setting a type
on Field.
# Tag types
# Sizes
# Modifiers
You can change the style of the tags by setting the rounded
and attached
props.
# Validation
You can validate the value before adding it to the tag list
# API
Name | Description | Type | Values | Default |
---|---|---|---|---|
v-model | Binding value | Array | — | — |
maxlength | Limits the length of each tag, plus character counter | String, Number | — | — |
maxtags | Limits the number of tags, plus tag counter | String, Number | — | — |
has-counter | Show counter when maxlength or maxtags props are passed | Boolean | — | true |
type | Type (color) of the tags, optional | String | is-white , is-black , is-light ,
is-dark , is-primary , is-info , is-success ,
is-warning , is-danger ,
and any other colors you've set in the $colors list on Sass | is-light |
closeType | Type (color) of the close icon, optional | String | is-white , is-black , is-light ,
is-dark , is-primary , is-info , is-success ,
is-warning , is-danger ,
and any other colors you've set in the $colors list on Sass | - |
size | Tag and input size, optional | String | is-small , is-medium , is-large | — |
rounded | Makes the tags rounded, optional | Boolean | — | false |
attached | Makes the tags attached instead of having an appended delete button, optional | Boolean | — | false |
ellipsis | Adds ellipsis on tags to not overflow the text. Title is then added to the tag with full text | Boolean | — | false |
closable | Add close/delete button to the tag | Boolean | — | true |
aria-close-label | Accessibility label for the close button | String | — | - |
field | Property of the object (if data is array of objects) to use as display text | String | — | value |
autocomplete | Add autocomplete feature (if true , any Autocomplete props may be used too) | Boolean | — | false |
group-field | Property of the object (if data is array of objects) to use as display text of group | String | — | |
group-options | Property of the object (if data is array of objects) to use as key to get items array of each group, optional | String | — | |
allow-new | When autocomplete , it allow to add new tags | Boolean | — | false |
open-on-focus | Opens a dropdown with choices when the input field is focused | Boolean | — | false |
remove-on-keys | Allow removing last tag when pressing given keys, if input is empty | Array | — | ["Backspace"] |
confirm-keys | Array of keys (https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values) which will add a tag when typing (default comma, tab and enter) | Array | — | [",", "Tab", "Enter"] |
on-paste-separators | Array of chars used to split when pasting a new string | Array | — | [','] |
before-adding | Function to validate the value of the tag before adding | Function | — | (tagToAdd) => true |
allow-duplicates | Allows adding the same tag multiple times | Boolean | — | false |
create-tag | Function to create tag item to push into v-model (tags) | Function | — | (tagToAdd) => tagToAdd |
readonly | Disable input/typing | Boolean | — | false |
check-infinite-scroll | Makes the autocomplete component check if list reached scroll end and emit infinite-scroll event. | Boolean | — | false |
append-to-body | Append autocomplete content to body (prevents event bubbling) | Boolean | — | false |
Any other native attribute | — | — | — | — |
# Variables
You can use these variables to customize this component.
Name | Default |
---|---|
$taginput-height | calc(2em - 1px) |
This page is open source. Noticed a typo or something's unclear?