Last active
July 17, 2023 23:12
-
-
Save dazeb/0d14259ff2c4925109283100ff20b86e to your computer and use it in GitHub Desktop.
nuxtlabs-searchbox-with-kbd-inside
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <UInput | |
| v-model="q" | |
| name="q" | |
| placeholder="Search..." | |
| icon="i-heroicons-magnifying-glass-20-solid" | |
| :ui="{ icon: { trailing: { pointer: '' } } }" | |
| > | |
| <template #trailing> | |
| <div class="flex items-center gap-0.5"> | |
| <UKbd>{{ metaSymbol }}</UKbd> | |
| <UKbd>K</UKbd> | |
| </div> | |
| <UButton | |
| v-show="q !== ''" | |
| color="gray" | |
| variant="link" | |
| icon="i-heroicons-x-mark-20-solid" | |
| :padded="false" | |
| @click="q = ''" | |
| /> | |
| </template> | |
| </UInput> | |
| </template> | |
| <script setup lang="ts"> | |
| const q = ref(""); | |
| const { metaSymbol } = useShortcuts(); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment