<div class="wrapper">
  <textarea></textarea>
</div>
body{
  padding: 0;
  margin: 0;
}
.wrapper{
  display: flex;
  justify-content: center;
  align-items:center;
  height: 100vh;
  padding-left: 20px;
  padding-right: 20px;

}

.tagify{
  width:400px;
  max-width:100%;
  border-radius:4px;
  --tag-pad :.2rem .4rem;
  
}
View Compiled
const whitelist1 = ['foo','bar','apple','banana','cherry','orange']
const whitelist2 = ['Mike','Jackson','Harry','Sophia','Chloe','Emma']
const textArea = document.querySelector('textarea') 
const tagify = new Tagify(textArea, {
    mode: 'mix',
    pattern: /#|@/,
    placeholder: "#apple and @Mike",
    whitelist: [],
    enforceWhitelist: true,
    dropdown: {
        enabled: 1,
    }
})

tagify.on('input', (e) => {
    const prefix = e.detail.prefix;
 
    if( prefix ){
        if( prefix == '#' )
            tagify.whitelist = whitelist1;

        if( prefix == '@' )
            tagify.whitelist = whitelist2;

    }
})

External CSS

  1. https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.css

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/tagify/4.27.0/tagify.min.js