feat: add name prop to Checkbox component

This commit is contained in:
Hossein Mehrabi 2023-03-01 14:02:09 +03:30
parent 907dc4b5d0
commit 0e512be105
1 changed files with 3 additions and 1 deletions

View File

@ -12,7 +12,7 @@ export type CheckboxProps = Omit<
> & > &
Pick< Pick<
React.InputHTMLAttributes<HTMLInputElement>, React.InputHTMLAttributes<HTMLInputElement>,
'onChange' | 'checked' | 'defaultChecked' 'name' | 'onChange' | 'checked' | 'defaultChecked'
> & { > & {
disabled?: boolean disabled?: boolean
indeterminate?: boolean indeterminate?: boolean
@ -23,6 +23,7 @@ export type CheckboxProps = Omit<
export const Checkbox: React.FC<CheckboxProps> & { export const Checkbox: React.FC<CheckboxProps> & {
classes: typeof checkboxClasses classes: typeof checkboxClasses
} = ({ } = ({
name,
size = 'large', size = 'large',
onChange, onChange,
checked, checked,
@ -75,6 +76,7 @@ export const Checkbox: React.FC<CheckboxProps> & {
> >
<input <input
ref={ref} ref={ref}
name={name}
type="checkbox" type="checkbox"
disabled={disabled} disabled={disabled}
checked={input.value} checked={input.value}