Back

Tags

Component useful to manage tags.

selector: stc-tags

How to use

Basic usage

<stc-tags></stc-tags>

Adding a custom placeholder

<stc-tags placeholder="My custom placeholder"></stc-tags>

Adding tags on load

<stc-tags placeholder="My custom placeholder"></stc-tags>
document.querySelector('stc-tags').tags = [{ text: 'first tag' }];

Adding tags after delay

<stc-tags placeholder="My custom placeholder"></stc-tags>
setTimeout(() => {
    document.querySelector('stc-tags').tags = [{ text: 'first tag' }];
}, 2000)

Props

name type description
tags { text: string, image?: string }[] Tag list will be rendered
placeholder string Custom placeholder of internal input element

Events

name data description
stc-tags-close { text: string, image?: string, id: string } Event triggered when a tag is closed