index.d.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import * as React from 'react';
  2. import type { SwitchChangeEventHandler, SwitchClickEventHandler } from 'rc-switch';
  3. export type SwitchSize = 'small' | 'default';
  4. export type { SwitchChangeEventHandler, SwitchClickEventHandler };
  5. export interface SwitchProps {
  6. prefixCls?: string;
  7. size?: SwitchSize;
  8. className?: string;
  9. rootClassName?: string;
  10. checked?: boolean;
  11. defaultChecked?: boolean;
  12. /**
  13. * Alias for `checked`.
  14. * @since 5.12.0
  15. */
  16. value?: boolean;
  17. /**
  18. * Alias for `defaultChecked`.
  19. * @since 5.12.0
  20. */
  21. defaultValue?: boolean;
  22. onChange?: SwitchChangeEventHandler;
  23. onClick?: SwitchClickEventHandler;
  24. checkedChildren?: React.ReactNode;
  25. unCheckedChildren?: React.ReactNode;
  26. disabled?: boolean;
  27. loading?: boolean;
  28. autoFocus?: boolean;
  29. style?: React.CSSProperties;
  30. title?: string;
  31. tabIndex?: number;
  32. id?: string;
  33. }
  34. declare const InternalSwitch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
  35. type CompoundedComponent = typeof InternalSwitch & {};
  36. declare const Switch: CompoundedComponent;
  37. export default Switch;