mirror of https://github.com/sylv/micro.git
19 lines
630 B
TypeScript
19 lines
630 B
TypeScript
import type { ComponentProps } from 'react';
|
|
import React from 'react';
|
|
import type { InputChildProps } from './container';
|
|
import { InputContainer } from './container';
|
|
|
|
type CheckboxBaseProps = InputChildProps<ComponentProps<'input'>>;
|
|
|
|
export interface CheckboxProps extends CheckboxBaseProps {
|
|
className?: string;
|
|
}
|
|
|
|
export const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(({ className, ...delegated }, ref) => {
|
|
return (
|
|
<InputContainer className={className} childProps={delegated}>
|
|
{({ childClasses, ...rest }) => <input {...rest} type="checkbox" ref={ref} />}
|
|
</InputContainer>
|
|
);
|
|
});
|