UNPKG

@carbon/react

Version:

React components for the Carbon Design System

86 lines (85 loc) 3.44 kB
/** * Copyright IBM Corp. 2016, 2025 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import PropTypes from 'prop-types'; import React, { AnimationEventHandler, MouseEventHandler, PropsWithChildren } from 'react'; export type DeprecatedCopyAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top'; export type NewCopyAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start'; export type CopyAlignment = DeprecatedCopyAlignment | NewCopyAlignment; export interface CopyProps extends React.ButtonHTMLAttributes<HTMLButtonElement> { /** * Specify how the trigger should align with the tooltip */ align?: CopyAlignment; /** * **Experimental**: Will attempt to automatically align the tooltip */ autoAlign?: boolean; /** * Specify an optional className to be applied to the underlying `<button>` */ className?: string; /** * Specify the string that is displayed when the button is clicked and the * content is copied */ feedback?: string; /** * Specify the time it takes for the feedback message to timeout */ feedbackTimeout?: number; /** * Specify an optional `onAnimationEnd` handler that is called when the underlying * animation ends */ onAnimationEnd?: AnimationEventHandler<HTMLButtonElement>; /** * Specify an optional `onClick` handler that is called when the underlying * `<button>` is clicked */ onClick?: MouseEventHandler<HTMLButtonElement>; } declare function Copy({ align, autoAlign, children, className, feedback, feedbackTimeout, onAnimationEnd, onClick, ...other }: PropsWithChildren<CopyProps>): import("react/jsx-runtime").JSX.Element; declare namespace Copy { var propTypes: { /** * Specify how the trigger should align with the tooltip */ align: (props: any, propName: any, componentName: any, ...rest: any[]) => any; /** * **Experimental**: Will attempt to automatically align the tooltip */ autoAlign: PropTypes.Requireable<boolean>; /** * Pass in content to be rendered in the underlying `<button>` */ children: PropTypes.Requireable<PropTypes.ReactNodeLike>; /** * Specify an optional className to be applied to the underlying `<button>` */ className: PropTypes.Requireable<string>; /** * Specify the string that is displayed when the button is clicked and the * content is copied */ feedback: PropTypes.Requireable<string>; /** * Specify the time it takes for the feedback message to timeout */ feedbackTimeout: PropTypes.Requireable<number>; /** * Specify an optional `onAnimationEnd` handler that is called when the underlying * animation ends */ onAnimationEnd: PropTypes.Requireable<(...args: any[]) => any>; /** * Specify an optional `onClick` handler that is called when the underlying * `<button>` is clicked */ onClick: PropTypes.Requireable<(...args: any[]) => any>; }; } export default Copy;