-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextInput.jsx
More file actions
53 lines (52 loc) · 1.19 KB
/
TextInput.jsx
File metadata and controls
53 lines (52 loc) · 1.19 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
45
46
47
48
49
50
51
52
53
export const TextInput = ({
onChange,
value,
placeholder,
label,
constraint,
isRequire = true,
type='',
defaultValue='',
}) => {
return (
<div>
<label
htmlFor={label}
className="mb-2.5 block text-sm font-medium text-black"
>
{label}
</label>
{ type=='readOnly' ?
<input
disabled
readOnly
defaultValue={defaultValue}
name={label}
pattern={constraint}
type="text"
value={value}
autoComplete="true"
onChange={onChange}
id={label}
className="mb-2.5 block w-full rounded-md border-2 border-black p-2.5 text-sm bg-[#E1E1E1]"
placeholder={placeholder}
required={isRequire}
/>
:
<input
defaultValue={defaultValue}
name={label}
pattern={constraint}
type="text"
value={value}
autoComplete="true"
onChange={onChange}
id={label}
className="mb-2.5 block w-full rounded-md border-2 border-black p-2.5 text-sm "
placeholder={placeholder}
required={isRequire}
/>
}
</div>
);
};