Open History to see the last commit
1"use client";
2
3import { Field as FieldPrimitive } from "@base-ui/react/field";
4
5import { cn } from "~/lib/utils";
6
7function Field({ className, ...props }: FieldPrimitive.Root.Props) {
8 return (
9 <FieldPrimitive.Root
10 className={cn("flex flex-col items-start gap-2", className)}
11 data-slot="field"
12 {...props}
13 />
14 );
15}
16
17function FieldLabel({ className, ...props }: FieldPrimitive.Label.Props) {
18 return (
19 <FieldPrimitive.Label
20 className={cn(
21 "inline-flex items-center gap-2 font-medium text-base/4.5 text-foreground sm:text-sm/4",
22 className,
23 )}
24 data-slot="field-label"
25 {...props}
26 />
27 );
28}
29
30function FieldItem({ className, ...props }: FieldPrimitive.Item.Props) {
31 return (
32 <FieldPrimitive.Item className={cn("flex", className)} data-slot="field-item" {...props} />
33 );
34}
35
36function FieldDescription({ className, ...props }: FieldPrimitive.Description.Props) {
37 return (
38 <FieldPrimitive.Description
39 className={cn("text-muted-foreground text-xs", className)}
40 data-slot="field-description"
41 {...props}
42 />
43 );
44}
45
46function FieldError({ className, ...props }: FieldPrimitive.Error.Props) {
47 return (
48 <FieldPrimitive.Error
49 className={cn("text-destructive-foreground text-xs", className)}
50 data-slot="field-error"
51 {...props}
52 />
53 );
54}
55
56const FieldControl = FieldPrimitive.Control;
57const FieldValidity = FieldPrimitive.Validity;
58
59export { Field, FieldLabel, FieldDescription, FieldError, FieldControl, FieldItem, FieldValidity };