button.d.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import React from 'react';
  2. import type { SizeType } from '../config-provider/SizeContext';
  3. import Group from './button-group';
  4. import type { ButtonColorType, ButtonHTMLType, ButtonShape, ButtonType, ButtonVariantType } from './buttonHelpers';
  5. export type LegacyButtonType = ButtonType | 'danger';
  6. export interface BaseButtonProps {
  7. type?: ButtonType;
  8. color?: ButtonColorType;
  9. variant?: ButtonVariantType;
  10. icon?: React.ReactNode;
  11. iconPosition?: 'start' | 'end';
  12. shape?: ButtonShape;
  13. size?: SizeType;
  14. disabled?: boolean;
  15. loading?: boolean | {
  16. delay?: number;
  17. icon?: React.ReactNode;
  18. };
  19. prefixCls?: string;
  20. className?: string;
  21. rootClassName?: string;
  22. ghost?: boolean;
  23. danger?: boolean;
  24. block?: boolean;
  25. children?: React.ReactNode;
  26. [key: `data-${string}`]: string;
  27. classNames?: {
  28. icon: string;
  29. };
  30. styles?: {
  31. icon: React.CSSProperties;
  32. };
  33. }
  34. type MergedHTMLAttributes = Omit<React.HTMLAttributes<HTMLElement> & React.ButtonHTMLAttributes<HTMLElement> & React.AnchorHTMLAttributes<HTMLElement>, 'type' | 'color'>;
  35. export interface ButtonProps extends BaseButtonProps, MergedHTMLAttributes {
  36. href?: string;
  37. htmlType?: ButtonHTMLType;
  38. autoInsertSpace?: boolean;
  39. }
  40. declare const InternalCompoundedButton: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
  41. type CompoundedComponent = typeof InternalCompoundedButton & {
  42. /** @deprecated Please use `Space.Compact` */
  43. Group: typeof Group;
  44. };
  45. declare const Button: CompoundedComponent;
  46. export default Button;