ultra-design
Version:
45 lines (44 loc) • 1.3 kB
TypeScript
import React from 'react';
export interface CheckboxEventTarget {
checked: boolean;
}
export interface CheckboxEvent {
target: CheckboxEventTarget;
stopPropagation: () => void;
preventDefault: () => void;
nativeEvent: React.ChangeEvent;
}
interface Props {
checked?: boolean;
/**
* @description.zh-CN 选中的值
* @description.en-US value
*/
value?: string;
/**
* @description.zh-CN 禁用复选框
* @description.en-US disable checkbox
*/
disabled?: boolean;
/**
* @description.zh-CN 默认选中
* @description.en-US checked as default
*/
defaultChecked?: boolean;
/**
* @description.zh-CN 复选框的值改变时触发的回调
* @description.en-US the callback triggered when the value of the checkbox changes
*/
onChange?: (e: CheckboxEvent) => void;
}
declare const defaultProps: {
disabled: boolean;
defaultChecked: boolean;
className: string;
value: string;
};
declare type NativeAttrs = Omit<React.InputHTMLAttributes<any>, keyof Props | 'size'>;
export declare type CheckboxProps = Props & NativeAttrs;
export declare type MergedCheckboxProps = typeof defaultProps & CheckboxProps;
declare const _default: React.FC<CheckboxProps>;
export default _default;