2024-12-02 17:20:27 +01:00
|
|
|
<script lang="ts" setup>
|
2025-04-10 13:55:56 +02:00
|
|
|
import { cn } from "@/lib/utils";
|
2024-12-02 17:20:27 +01:00
|
|
|
import { ErrorMessage } from "vee-validate";
|
2025-04-10 13:55:56 +02:00
|
|
|
import { type HTMLAttributes, toValue } from "vue";
|
2024-12-02 17:20:27 +01:00
|
|
|
import { useFormField } from "./useFormField";
|
|
|
|
|
|
2025-04-10 13:55:56 +02:00
|
|
|
const props = defineProps<{
|
|
|
|
|
class?: HTMLAttributes["class"];
|
|
|
|
|
}>();
|
|
|
|
|
|
2024-12-02 17:20:27 +01:00
|
|
|
const { name, formMessageId } = useFormField();
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<ErrorMessage
|
|
|
|
|
:id="formMessageId"
|
2025-04-10 13:55:56 +02:00
|
|
|
data-slot="form-message"
|
2024-12-02 17:20:27 +01:00
|
|
|
as="p"
|
|
|
|
|
:name="toValue(name)"
|
2025-04-10 13:55:56 +02:00
|
|
|
:class="cn('text-destructive-foreground text-sm', props.class)"
|
2024-12-02 17:20:27 +01:00
|
|
|
/>
|
|
|
|
|
</template>
|