-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Checkbox component for enhanced form functionality
- Loading branch information
1 parent
39d90c3
commit 2b34e47
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
backend/experiment/templates/form/experiment-form/src/components/form/Checkbox.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
|
||
interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> { | ||
label?: string; | ||
} | ||
|
||
export const Checkbox: React.FC<CheckboxProps> = ({ className = '', label, ...props }) => { | ||
return ( | ||
<label className="inline-flex items-center"> | ||
<input | ||
type="checkbox" | ||
{...props} | ||
className={` | ||
w-4 h-4 text-blue-600 rounded | ||
border-gray-300 shadow-sm | ||
focus:border-blue-500 focus:ring-2 focus:ring-blue-200 focus:ring-opacity-50 | ||
disabled:bg-gray-100 disabled:cursor-not-allowed | ||
${className} | ||
`} | ||
/> | ||
{label && <span className="ml-2 text-gray-700">{label}</span>} | ||
</label> | ||
); | ||
}; |