Brisanet/ion-react

View on GitHub
src/components/checkbox/checkbox.tsx

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { InputHTMLAttributes } from 'react';
import { Checkbox, CheckboxContainer, Label } from './styles';
 
export type CheckboxProps = {
label?: string;
} & InputHTMLAttributes<HTMLInputElement>;
 
export const IonCheckbox = ({ label, id, ...props }: CheckboxProps) => {
return (
<CheckboxContainer>
<Checkbox {...props} id={id} type='checkbox' data-testid='ion-checkbox' />
{!!label && <Label htmlFor={id}>{label}</Label>}
</CheckboxContainer>
);
};