Bootstrap tags input
Install with npm:
npm install @erwinstone/bs-tag
Install from cdn:
Place css
between <head></head>
tags:
<head>
...
<link href="https://unpkg.com/@erwinstone/bs-tag@1.0.1/dist/bs-tag.min.css" rel="stylesheet">
</head>
Place js
before </body>
tag:
<body>
...
<script src="https://unpkg.com/@erwinstone/bs-tag@1.0.1/dist/bs-tag.min.js"></script>
</body>
* You can also use bs-tag as javascript module:
<script src="yourscript.js" type="module"></script>
In yourscript.js
file, import BsTag (Change location according to your path):
import BsTag from './path/to/bs-tag.module.js'
Or you can use it directly in the html script as a module:
<script type="module">
import BsTag from './path/to/bs-tag.module.js'
</script>
Example tags with "space" separator.
Sometimes we need to transform tags. Example tags with toUpperCase()
.
Name | Type | Default | Description |
---|---|---|---|
separator |
string | , |
Separator between tags |
duplicate |
boolean | false |
Allow duplicates |
transform |
string | input => input |
Function to change value. The function must be an arrow function |
enter |
boolean | false |
Force adding tag when enter key is pressed |
Name | Params | Returns | Example |
---|---|---|---|
addValue |
string | array |
void |
|
removeValue |
string | array |
void |
|
getValue |
null |
string |
|
getValues |
null |
array |
|