Gridlock / app /frontend /src /components /ui /input.tsx
parvmittal07's picture
Initial Demo complete
01eb82e
Raw
History Blame Contribute Delete
1.76 kB
import * as React from "react";
import { cn } from "@/lib/utils";
export const Input = React.forwardRef<
HTMLInputElement,
React.InputHTMLAttributes<HTMLInputElement>
>(({ className, type, ...props }, ref) => (
<input
type={type}
ref={ref}
className={cn(
"flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground ring-offset-background transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
className
)}
{...props}
/>
));
Input.displayName = "Input";
export const Textarea = React.forwardRef<
HTMLTextAreaElement,
React.TextareaHTMLAttributes<HTMLTextAreaElement>
>(({ className, ...props }, ref) => (
<textarea
ref={ref}
className={cn(
"flex min-h-[72px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground ring-offset-background transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
className
)}
{...props}
/>
));
Textarea.displayName = "Textarea";
export function Label({
className,
children,
hint,
...props
}: React.LabelHTMLAttributes<HTMLLabelElement> & { hint?: string }) {
return (
<label
className={cn(
"mb-1.5 flex items-center gap-1.5 text-xs font-medium text-muted-foreground",
className
)}
{...props}
>
{children}
{hint && (
<span className="rounded bg-secondary px-1.5 py-0.5 text-[10px] font-normal text-muted-foreground">
{hint}
</span>
)}
</label>
);
}