Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@yaireo/tagify
Advanced tools
Want to simply convert an input field into a tags element, in a easy customizable way, with good performance and smallest code footprint? You are in the right place my friend.
Want to simply convert an input field into a tags element, in a easy customizable way, with good performance and smallest code footprint? You are in the right place my friend.
hellip
by giving max-width
to the tag
element in your CSS
Simply run gulp
in your terminal, from the project's path (Gulp should be installed first)
Lets say this is your markup, and you already have a value set on the input (which was pre-filled by data from the server):
<input name='tags' placeholder='write some tags' value='foo, bar,buzz'>
<textarea name='tags' placeholder='write some tags'>foo, bar,buzz</textarea>
what you need to do to convert that nice input into "tags" is simply select your input/textarea and run tagify()
:
// vanilla component
var input = document.querySelector('input[name=tags]'),
tagify = new Tagify( input );
// with settings passed
tagify = new Tagify( input, {
duplicates: true,
whitelist: ['foo', 'bar']},
callbacks: {
add : onAddTag // calls an imaginary "onAddTag" function when a tag is added
}
);
// when using jQuery plugin version file `jQuery.tagify.js`
$('[name=tags]').tagify()
// listen to custom tags' events such as 'add' or 'remove'
tagify1.on('remove', ()=>{
console.log(e, e.detail);
});
Now markup be like:
<tags>
<tag>
<x></x>
<div><span title="css">css</span></div>
</tag>
<tag>
<x></x>
<div><span title="html">html</span></div>
</tag>
<tag>
<x></x>
<div><span title="javascript">javascript</span></div>
</tag>
<div>
<input list="tagsSuggestions3l9nbieyr" class="input placeholder">
<datalist id="tagsSuggestions3l9nbieyr">
<label> select from the list:
<select>
<option value=""></option>
<option>foo</option>
<option>bar</option>
</select>
</label>
</datalist><span>write some tags</span>
</div>
<input name="tags" placeholder="write some tags" value="foo, bar,buzz">
</tags>
Name | Info |
---|---|
destroy | if called, will revert the input back as it was before Tagify was applied |
Name | Info |
---|---|
add | A tag has been added |
remove | A tag has been removed |
duplicate | A tag has been added and found to be a duplicate of existing one |
maxTagsExceed | Number of tags exceeds the allowed quantity and the exceed tags were denied (removed) |
blacklisted | A tag which is in the blacklist has been added and denied (removed) |
notWhitelisted | A tag which is not in the whitelist has been added and denied (removed) |
Name | Type | Default | Info |
---|---|---|---|
duplicates | Boolean | false | (flag) should duplicate tags be allowed or not |
enforeWhitelist | Boolean | false | should ONLY use tags allowed in whitelist |
autocomplete | Boolean | true | show native suggeestions list, as you type |
whitelist | Array | [] | an array of tags which only they are allowed |
blacklist | Array | [] | an array of tags which aren't allowed |
callbacks | Object | {} | exposed callbacks object to be triggered on events: 'add' / 'remove' tags |
maxTags | Number | Infinity | max number of tags |
suggestionsMinChars | Number | 2 | minimum characters to input which shows the sugegstions list |
FAQs
lightweight, efficient Tags input component in Vanilla JS / React / Angular [super customizable, tiny size & top performance]
The npm package @yaireo/tagify receives a total of 63,401 weekly downloads. As such, @yaireo/tagify popularity was classified as popular.
We found that @yaireo/tagify demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.