Skip to content

Instantly share code, notes, and snippets.

@dazeb
Last active July 17, 2023 23:12
Show Gist options
  • Select an option

  • Save dazeb/0d14259ff2c4925109283100ff20b86e to your computer and use it in GitHub Desktop.

Select an option

Save dazeb/0d14259ff2c4925109283100ff20b86e to your computer and use it in GitHub Desktop.
nuxtlabs-searchbox-with-kbd-inside
<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