Here is a slight more complex Tributejs with AlpineJs...
<div class="flex gap-1 w-full" x-data="{ mentionables : @entangle('mentionables') }"
x-init='
$nextTick(() => {
let thisRef = $refs.{{ $emit }};
let tribute = new Tribute({
noMatchTemplate: function () {
return "<span onclick=\"window.Livewire.emit(`addCompany`); this.remove()\" " +
"class=\"p-3 py-1 block bg-blue-500 text-white rounded-md cursor-pointer\">Add<\/span>"
},
menuItemTemplate: function (item) {
return "<div class=\"flex items-center gap-1\">" +
"<div>" + item.string + "</div>" +
"</div>";
},
selectTemplate: function (item) {
$wire.add(item.original)
$wire.set("search", "")
return "";
},
values: function (text, cb) {
cb(mentionables)
},
autocompleteMode: true,
allowSpaces: true,
trigger: "",
});
tribute.attach(thisRef);
})
'>
...