-
Notifications
You must be signed in to change notification settings - Fork 271
/
Copy pathCheckbox.tsx
44 lines (41 loc) · 1.09 KB
/
Checkbox.tsx
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';
interface IFieldCheckbox {
name: string;
label: string;
checked: boolean;
onChange: any;
placeholder?: string;
disabled?: boolean;
}
export const FieldCheckbox = (props: IFieldCheckbox) => {
return (
<div className="flex items-start mt-1 mb-3">
<div className="flex items-center h-5">
<input
type="checkbox"
id={props.name}
className="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded"
checked={props.checked}
onChange={props.onChange}
disabled={props.disabled}
/>
</div>
<div className="ml-3 text-sm">
<label
htmlFor={props.name}
className="font-medium text-gray-700 dark:text-gray-200"
style={
props.disabled ? { textDecoration: 'line-through' } : undefined
}
>
{props.label}
</label>
{props.placeholder && (
<p className="text-gray-500 dark:text-gray-300">
{props.placeholder}
</p>
)}
</div>
</div>
);
};