Advertisement
Guest User

Untitled

a guest
Apr 11th, 2021
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.94 KB | None | 0 0
  1.     <form method="post">
  2.     <div x-data @tags-update="console.log('tags updated', $event.detail.tags)" data-tags='["aaa","bbb"]' class="max-w-lg m-6">
  3.       <div x-data="tagSelect()" x-init="init('parentEl')" @click.away="clearSearch()" @keydown.escape="clearSearch()">
  4.         <div class="relative" @keydown.enter.prevent="addTag(textInput)">
  5.           <input x-model="textInput" x-ref="textInput" @input="search($event.target.value)" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" placeholder="Enter some tags">
  6.           <div :class="[open ? 'block' : 'hidden']">
  7.             <div class="absolute z-40 left-0 mt-2 w-full">
  8.               <div class="py-1 text-sm bg-white rounded shadow-lg border border-gray-300">
  9.                 <a @click.prevent="addTag(textInput)" class="block py-1 px-5 cursor-pointer hover:bg-indigo-600 hover:text-white">Add tag "<span class="font-semibold" x-text="textInput"></span>"</a>
  10.               </div>
  11.             </div>
  12.           </div>
  13.           <!-- selections -->
  14.           <template x-for="(tag, index) in tags">
  15.             <div class="bg-indigo-100 inline-flex items-center text-sm rounded mt-2 mr-1">
  16.               <span class="ml-2 mr-1 leading-relaxed truncate max-w-xs" x-text="tag"></span>
  17.               <button @click.prevent="removeTag(index)" class="w-6 h-8 inline-block align-middle text-gray-500 hover:text-gray-600 focus:outline-none">
  18.                 <svg class="w-6 h-6 fill-current mx-auto" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M15.78 14.36a1 1 0 0 1-1.42 1.42l-2.82-2.83-2.83 2.83a1 1 0 1 1-1.42-1.42l2.83-2.82L7.3 8.7a1 1 0 0 1 1.42-1.42l2.83 2.83 2.82-2.83a1 1 0 0 1 1.42 1.42l-2.83 2.83 2.83 2.82z"/></svg>
  19.               </button>
  20.             </div>
  21.           </template>
  22.         </div>
  23.       </div>
  24.     </div>
  25.  
  26.     <input type="submit" value="create tags">
  27.     </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement