25 lines
1.3 KiB
TypeScript
25 lines
1.3 KiB
TypeScript
import * as React from "react";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
const fieldClass =
|
|
"w-full min-w-0 rounded-md border border-input bg-background/60 px-3 text-sm text-foreground shadow-xs outline-none transition-[color,box-shadow] placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/40 disabled:opacity-50";
|
|
|
|
function Input({ className, type = "text", ...props }: React.ComponentProps<"input">) {
|
|
return <input type={type} data-slot="input" className={cn(fieldClass, "h-9 py-1", className)} {...props} />;
|
|
}
|
|
|
|
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
|
return <textarea data-slot="textarea" className={cn(fieldClass, "min-h-16 resize-y py-2", className)} {...props} />;
|
|
}
|
|
|
|
/** Native select styled like the inputs: no client JS, works inside server-action forms. */
|
|
function NativeSelect({ className, ...props }: React.ComponentProps<"select">) {
|
|
return <select data-slot="select" className={cn(fieldClass, "h-9 py-1 pr-8", className)} {...props} />;
|
|
}
|
|
|
|
function Label({ className, ...props }: React.ComponentProps<"label">) {
|
|
return <label data-slot="label" className={cn("flex flex-col gap-1.5 text-sm font-medium", className)} {...props} />;
|
|
}
|
|
|
|
export { Input, Textarea, NativeSelect, Label, fieldClass };
|