UNPKG

2.13 kBTypeScriptView Raw
1/// <reference types="react" />
2
3import * as React from 'react';
4import CommonProps from '../util';
5
6export interface GroupProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
7 /**
8 * 统一设置 Button 组件的按钮大小
9 */
10 size?: string;
11}
12
13export class Group extends React.Component<GroupProps, any> {}
14interface HTMLAttributesWeak extends React.ButtonHTMLAttributes<HTMLElement> {
15 type?: any;
16 onClick?: any;
17}
18
19export interface ButtonProps extends HTMLAttributesWeak, CommonProps {
20 /**
21 * 按钮的类型
22 */
23 type?: 'primary' | 'secondary' | 'normal';
24
25 /**
26 * 按钮的尺寸
27 */
28 size?: 'small' | 'medium' | 'large';
29 /**
30 * 按钮中 Icon 的尺寸,用于替代 Icon 的默认大小
31 */
32 icons?: { loading?: React.ReactNode };
33 /**
34 * 按钮中 Icon 的尺寸,用于替代 Icon 的默认大小
35 */
36 iconSize?:
37 | number
38 | 'xxs'
39 | 'xs'
40 | 'small'
41 | 'medium'
42 | 'large'
43 | 'xl'
44 | 'xxl'
45 | 'xxxl'
46 | 'inherit';
47
48 /**
49 * 当 component = 'button' 时,设置 button 标签的 type 值
50 */
51 htmlType?: 'submit' | 'reset' | 'button';
52
53 /**
54 * 设置标签类型
55 */
56 component?: 'button' | 'a' | React.ReactNode;
57
58 /**
59 * 设置按钮的载入状态
60 */
61 loading?: boolean;
62
63 /**
64 * 是否为幽灵按钮
65 */
66 ghost?: true | false | 'light' | 'dark';
67
68 /**
69 * 是否为文本按钮
70 */
71 text?: boolean;
72
73 /**
74 * 是否为警告按钮
75 */
76 warning?: boolean;
77
78 /**
79 * 是否禁用
80 */
81 disabled?: boolean;
82
83 /**
84 * 点击按钮的回调
85 */
86 onClick?: React.MouseEventHandler;
87
88 /**
89 * 在Button组件使用component属性值为a时有效,代表链接页面的URL
90 */
91 href?: string;
92
93 /**
94 * 在Button组件使用component属性值为a时有效,代表何处打开链接文档
95 */
96 target?: string;
97}
98
99export default class Button extends React.Component<ButtonProps, any> {
100 static Group: typeof Group;
101}