2024-12-02 17:20:27 +01:00
|
|
|
<script lang="ts" setup>
|
2025-03-28 01:16:24 +01:00
|
|
|
import { Label } from "@/components/ui/label";
|
2024-12-02 17:20:27 +01:00
|
|
|
import { cn } from "@/lib/utils";
|
2025-03-28 01:16:24 +01:00
|
|
|
import type { LabelProps } from "reka-ui";
|
2024-12-02 17:20:27 +01:00
|
|
|
import type { HTMLAttributes } from "vue";
|
|
|
|
|
import { useFormField } from "./useFormField";
|
|
|
|
|
|
|
|
|
|
const props = defineProps<LabelProps & { class?: HTMLAttributes["class"] }>();
|
|
|
|
|
|
|
|
|
|
const { error, formItemId } = useFormField();
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<Label
|
|
|
|
|
:class="cn(
|
|
|
|
|
error && 'text-destructive',
|
|
|
|
|
props.class,
|
|
|
|
|
)"
|
|
|
|
|
:for="formItemId"
|
|
|
|
|
>
|
|
|
|
|
<slot />
|
|
|
|
|
</Label>
|
|
|
|
|
</template>
|