UNPKG

@kisstar/rc-ui

Version:

UI component library built with React Hooks.

37 lines (36 loc) 1.52 kB
import React from 'react'; export declare type ButtonHTMLType = 'button' | 'submit' | 'reset'; export declare type ButtonType = 'primary' | 'link'; export declare type ButtonSize = 'large' | 'sm'; export interface BaseButtonProps { /** 设置按钮类型 */ type?: ButtonType; /** 设置按钮大小 */ size?: ButtonSize; /** 设置危险按钮 */ danger?: boolean; prefixCls?: string; className?: string; children?: React.ReactNode; } export declare type AnchorButtonProps = { /** 点击跳转的地址,指定此属性 `button` 的行为和 `a` 链接一致 */ href: string; /** 相当于 `a` 链接的 `target` 属性,`href` 存在时生效 */ target?: string; onClick?: React.MouseEventHandler<HTMLElement>; } & BaseButtonProps & Omit<React.AnchorHTMLAttributes<HTMLElement>, 'type' | 'onClick'>; export declare type NativeButtonProps = { /** 设置 `button` 原生的 `type` 值,可选值请参考 HTML 标准 */ htmlType?: ButtonHTMLType; /** 点击按钮时的回调 */ onClick?: React.MouseEventHandler<HTMLElement>; } & BaseButtonProps & Omit<React.ButtonHTMLAttributes<HTMLElement>, 'type' | 'onClick'>; export declare type ButtonProps = Partial<AnchorButtonProps & NativeButtonProps>; /** * 按钮用于开始一个即时操作。 * * 在 Rc-UI 中提供了三种按钮:主按钮、默认按钮、链接按钮,以及危险、禁用两种状态。 */ export declare const Button: React.FC<ButtonProps>; export default Button;