yzsd
Version:
a niubi UI component
46 lines (45 loc) • 1.55 kB
TypeScript
import React from 'react';
import Group from './button-group';
export type ButtonType = 'default' | 'primary' | 'ghost' | 'dashed' | 'danger' | 'link' | 'text';
export type ButtonShape = 'circle' | 'default' | 'round';
export type ButtonSize = 'large' | 'default' | 'small';
export type ButtonHTMLType = 'submit' | 'button' | 'reset';
export interface BaseButtonProps {
type?: ButtonType;
icon?: React.ReactNode;
shape?: ButtonShape;
size?: ButtonSize;
disabled?: boolean;
loading?: boolean | {
delay?: number;
};
prefixCls?: string;
className?: string;
rootClassName?: string;
ghost?: boolean;
danger?: boolean;
block?: boolean;
children?: React.ReactNode;
[key: `data-${string}`]: string;
classNames?: {
icon: string;
};
styles?: {
icon: React.CSSProperties;
};
}
export type AnchorButtonProps = {
href: string;
target?: string;
onClick?: React.MouseEventHandler<HTMLElement>;
} & BaseButtonProps & Omit<React.AnchorHTMLAttributes<any>, 'type' | 'onClick'>;
export type NativeButtonProps = {
htmlType?: ButtonHTMLType;
onClick?: React.MouseEventHandler<HTMLElement>;
} & BaseButtonProps & Omit<React.ButtonHTMLAttributes<any>, 'type' | 'onClick'>;
type CompoundedComponent = React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLElement>> & {
Group: typeof Group;
};
export type ButtonProps = Partial<AnchorButtonProps & NativeButtonProps>;
declare const Button: CompoundedComponent;
export default Button;