-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.tsx
More file actions
44 lines (38 loc) · 1.21 KB
/
input.tsx
File metadata and controls
44 lines (38 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import * as React from 'react';
import { cn } from '@/lib/utils';
import { cva, type VariantProps } from 'class-variance-authority';
const inputVariants = cva(
'flex h-10 w-full px-3 py-2 text-base placeholder:text-neutral-500 focus-visible:outline-none focus-visible:ring-0 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
{
variants: {
variant: {
default:
'border border-neutral-200 bg-white dark:bg-neutral-950 dark:border-neutral-800',
underline: 'border-0 border-b border-neutral-200 bg-transparent ',
'contact-unfilled':
'bg-transparent border-b border-gray-300 p-0 placeholder:text-grey-300',
},
},
defaultVariants: {
variant: 'default',
},
}
);
// ✅ Fix: Explicitly type the variant prop
interface InputProps
extends React.ComponentProps<'input'>,
VariantProps<typeof inputVariants> {}
const Input = React.forwardRef<HTMLInputElement, InputProps>(
({ className, type, variant, ...props }, ref) => {
return (
<input
type={type}
className={cn(inputVariants({ variant }), className)}
ref={ref}
{...props}
/>
);
}
);
Input.displayName = 'Input';
export { Input };