UNPKG

yantd

Version:

React component library

33 lines (32 loc) 1.32 kB
import React, { ButtonHTMLAttributes, AnchorHTMLAttributes, FC, ReactNode } from "react"; import { Omit } from "../_util/type"; export declare enum ButtonSize { Large = "lg", Small = "sm" } declare const ButtonTypes: ["default", "primary", "danger", "dashed", "link", "text"]; export declare type ButtonType = typeof ButtonTypes[number]; declare const ButtonShapes: ["circle", "round"]; export declare type ButtonShape = typeof ButtonShapes[number]; declare const ButtonHTMLTypes: ["submit", "button", "reset"]; export declare type ButtonHTMLType = typeof ButtonHTMLTypes[number]; export interface BaseButtonProps { className?: string; disabled?: boolean; size?: "lg" | "sm"; type?: ButtonType; children: ReactNode; shape?: ButtonShape; onClick?: React.MouseEventHandler<HTMLElement>; prefixCls?: string; } export declare type AnchorButtonProps = { href: string; target?: string; } & BaseButtonProps & Omit<AnchorHTMLAttributes<HTMLElement>, 'type' | 'onClick'>; export declare type NativeButtonProps = { htmlType?: ButtonHTMLType; } & BaseButtonProps & Omit<ButtonHTMLAttributes<HTMLElement>, 'type' | 'onClick'>; export declare type ButtonProps = Partial<NativeButtonProps & AnchorButtonProps>; export declare const Button: FC<ButtonProps>; export default Button;