mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
35 lines
1022 B
TypeScript
35 lines
1022 B
TypeScript
import { cn } from "@/lib/utils";
|
|
import * as React from "react";
|
|
|
|
export interface InputProps
|
|
extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
errorMessage?: string;
|
|
}
|
|
|
|
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
({ className, errorMessage, type, ...props }, ref) => {
|
|
return (
|
|
<>
|
|
<input
|
|
type={type}
|
|
className={cn(
|
|
// bg-gray
|
|
"flex h-10 w-full rounded-md bg-input px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
className,
|
|
)}
|
|
ref={ref}
|
|
{...props}
|
|
/>
|
|
{errorMessage && (
|
|
<span className="text-sm text-red-600 text-secondary-foreground">
|
|
{errorMessage}
|
|
</span>
|
|
)}
|
|
</>
|
|
);
|
|
},
|
|
);
|
|
Input.displayName = "Input";
|
|
|
|
export { Input };
|