UNPKG

1.6 kBTypeScriptView Raw
1import React from 'react';
2import type { ReactNode } from 'react';
3import { NativeProps } from '../../utils/native-props';
4export declare type CheckboxValue = string | number;
5export declare type CheckboxProps = {
6 checked?: boolean;
7 defaultChecked?: boolean;
8 disabled?: boolean;
9 onChange?: (checked: boolean) => void;
10 value?: CheckboxValue;
11 indeterminate?: boolean;
12 block?: boolean;
13 id?: string;
14 icon?: (checked: boolean, indeterminate: boolean) => ReactNode;
15 children?: ReactNode;
16 onClick?: (event: React.MouseEvent<HTMLLabelElement, MouseEvent>) => void;
17} & NativeProps<'--icon-size' | '--font-size' | '--gap'>;
18export declare type CheckboxRef = {
19 check: () => void;
20 uncheck: () => void;
21 toggle: () => void;
22};
23export declare const Checkbox: React.ForwardRefExoticComponent<{
24 checked?: boolean | undefined;
25 defaultChecked?: boolean | undefined;
26 disabled?: boolean | undefined;
27 onChange?: ((checked: boolean) => void) | undefined;
28 value?: CheckboxValue | undefined;
29 indeterminate?: boolean | undefined;
30 block?: boolean | undefined;
31 id?: string | undefined;
32 icon?: ((checked: boolean, indeterminate: boolean) => ReactNode) | undefined;
33 children?: ReactNode;
34 onClick?: ((event: React.MouseEvent<HTMLLabelElement, MouseEvent>) => void) | undefined;
35} & {
36 className?: string | undefined;
37 style?: (React.CSSProperties & Partial<Record<"--font-size" | "--icon-size" | "--gap", string>>) | undefined;
38 tabIndex?: number | undefined;
39} & React.AriaAttributes & React.RefAttributes<CheckboxRef>>;
40
\No newline at end of file