function TagInput({...})
A form multi-select control for editing a list of tag values. It supports drag sorting, option selection, inline creation of new tags, keyboard interaction, and custom icons/translations.
- Description:
function TagInput({...})
A form multi-select control for editing a list of tag values. It supports drag sorting, option selection, inline creation of new tags, keyboard interaction, and custom icons/translations.
- Source:
Properties:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
value |
string | Array.<string> | Array.<string> | required value as a comma-separated string or array |
||
commaValue |
boolean |
<optional> |
true
|
emit a comma-separated string when true, otherwise an array |
options |
SelectOption |
<optional> |
[]
|
option list used in the dropdown |
oninput |
function | callback for value changes, receives |
||
disabled |
boolean |
<optional> |
disable the control |
|
onContextMenu |
function |
<optional> |
optional callback |
|
dragSort |
boolean |
<optional> |
true
|
allow drag and drop reordering |
delIcon |
'left' | 'right' | 'none' |
<optional> |
'none'
|
remove button position |
orderIcon |
boolean |
<optional> |
false
|
display sort order icon |
allowCreate |
boolean |
<optional> |
true
|
allow creating new tag values |
multi |
boolean |
<optional> |
true
|
enable multi-select behavior |
bsSize |
string |
<optional> |
''
|
bootstrap size like |
closeOnCheck |
boolean |
<optional> |
false
|
close the dropdown after selecting an item |
tagColor |
string |
<optional> |
'text-bg-primary'
|
badge color class |
style |
string |
<optional> |
extra CSS style for the control |
|
placeholder |
string |
<optional> |
placeholder shown when no tags are selected |
|
loading |
boolean |
<optional> |
show a loading spinner when true |
|
tabindex |
number | string |
<optional> |
0
|
tab index of the control |
icons |
object |
<optional> |
overwrite the default icons |
|
t |
function |
<optional> |
custom translation function |
|
...props |
object |
<optional> |
any additional HTML attributes for the wrapping input group |
Example
import TagInput from 'vanjs-bootstrap/tag-input';
const values = van.state('red,blue');
const input = TagInput({
value: values.val,
options: 'red,green,blue',
oninput: e => values.val = e.target.value,
});
Returns:
- Type
- HTMLElement