UNPKG

1.78 kBTypeScriptView Raw
1import * as React from 'react';
2import Group from './button-group';
3import { Omit } from '../_util/type';
4import { SizeType } from '../config-provider/SizeContext';
5declare const ButtonTypes: ["default", "primary", "ghost", "dashed", "link", "text"];
6export declare type ButtonType = typeof ButtonTypes[number];
7declare const ButtonShapes: ["circle", "round"];
8export declare type ButtonShape = typeof ButtonShapes[number];
9declare const ButtonHTMLTypes: ["submit", "button", "reset"];
10export declare type ButtonHTMLType = typeof ButtonHTMLTypes[number];
11export declare type LegacyButtonType = ButtonType | 'danger';
12export declare function convertLegacyProps(type?: LegacyButtonType): ButtonProps;
13export interface BaseButtonProps {
14 type?: ButtonType;
15 icon?: React.ReactNode;
16 shape?: ButtonShape;
17 size?: SizeType;
18 loading?: boolean | {
19 delay?: number;
20 };
21 prefixCls?: string;
22 className?: string;
23 ghost?: boolean;
24 danger?: boolean;
25 block?: boolean;
26 children?: React.ReactNode;
27}
28export declare type AnchorButtonProps = {
29 href: string;
30 target?: string;
31 onClick?: React.MouseEventHandler<HTMLElement>;
32} & BaseButtonProps & Omit<React.AnchorHTMLAttributes<any>, 'type' | 'onClick'>;
33export declare type NativeButtonProps = {
34 htmlType?: ButtonHTMLType;
35 onClick?: React.MouseEventHandler<HTMLElement>;
36} & BaseButtonProps & Omit<React.ButtonHTMLAttributes<any>, 'type' | 'onClick'>;
37export declare type ButtonProps = Partial<AnchorButtonProps & NativeButtonProps>;
38interface CompoundedComponent extends React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLElement>> {
39 Group: typeof Group;
40 __ANT_BUTTON: boolean;
41}
42declare const Button: CompoundedComponent;
43export default Button;