SelectMenu trailing Button NuxtUI

Hi, i try use trailing slot for my button, it is rendered but i can not clink on it ?
<script setup lang="ts">
import { useField } from "vee-validate";
import { IsSelectVariant } from "~/types/variants";
import type { CodebookDto } from "~~/apis/client-is/models";

const props = withDefaults(
defineProps<{
label: string;
name: string;
options: Array<any> | Array<CodebookDto> | undefined;
optionAttribute?: string;
valueAttribute?: string;
variant?: IsSelectVariant;
}>(),
{
variant: IsSelectVariant.default,
optionAttribute: "value",
valueAttribute: "id",
}
);

const emit = defineEmits(["update:modelValue"]);

const { value: modelValueProxy, errorMessage } = useField<string>(props.name);

const fieldProps = computed(() => ({
error: errorMessage.value,
}));
</script>

<template>
<UFormGroup
:label="props.label"
:name="props.name"
v-bind="fieldProps"
:hint="props.variant == IsSelectVariant.optional ? '(nepovinný údaj)' : ''"
>
<USelectMenu
v-model="modelValueProxy"
:options="props.options"
:optionAttribute="props.optionAttribute"
:valueAttribute="props.valueAttribute"
>
<template #empty>Zoznam je prázdny </template>
<template #trailing>
<UButton
v-show="modelValueProxy != null"
color="gray"
variant="link"
icon="i-heroicons-x-mark-20-solid"
:padded="false"
@click="console.log('clear')"
/>
</template>
</USelectMenu>
</UFormGroup>
</template>
<script setup lang="ts">
import { useField } from "vee-validate";
import { IsSelectVariant } from "~/types/variants";
import type { CodebookDto } from "~~/apis/client-is/models";

const props = withDefaults(
defineProps<{
label: string;
name: string;
options: Array<any> | Array<CodebookDto> | undefined;
optionAttribute?: string;
valueAttribute?: string;
variant?: IsSelectVariant;
}>(),
{
variant: IsSelectVariant.default,
optionAttribute: "value",
valueAttribute: "id",
}
);

const emit = defineEmits(["update:modelValue"]);

const { value: modelValueProxy, errorMessage } = useField<string>(props.name);

const fieldProps = computed(() => ({
error: errorMessage.value,
}));
</script>

<template>
<UFormGroup
:label="props.label"
:name="props.name"
v-bind="fieldProps"
:hint="props.variant == IsSelectVariant.optional ? '(nepovinný údaj)' : ''"
>
<USelectMenu
v-model="modelValueProxy"
:options="props.options"
:optionAttribute="props.optionAttribute"
:valueAttribute="props.valueAttribute"
>
<template #empty>Zoznam je prázdny </template>
<template #trailing>
<UButton
v-show="modelValueProxy != null"
color="gray"
variant="link"
icon="i-heroicons-x-mark-20-solid"
:padded="false"
@click="console.log('clear')"
/>
</template>
</USelectMenu>
</UFormGroup>
</template>
2 Replies
johntanzer
johntanzer3mo ago
Hey. Yea this is because of pointer events none. Just add this :ui="{ icon: { trailing: { pointer: '' } } }"
Dominik Baranec
Dominik BaranecOP2mo ago
thanks it works
Want results from more Discord servers?
Add your server