You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB
JavaScript

import React from 'react'
export default function Checkbox({
value,
name,
onChange,
label = '',
error,
disabled = false,
}) {
return (
<>
<div className="flex items-center mb-1">
<input
type="checkbox"
checked={value}
onChange={onChange}
name={name}
disabled={disabled}
className="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
/>
{label !== '' && (
<label className="ml-2 text-sm font-medium text-gray-900 dark:text-gray-300">
{label}
</label>
)}
</div>
{error && (
<p className="mb-2 text-sm text-red-600 dark:text-red-500">
{error}
</p>
)}
</>
)
}