@grafana/ui
Version:
Grafana Components Library
16 lines (15 loc) • 928 B
TypeScript
import { ButtonProps } from '../Button/Button';
export type Props = ButtonProps & {
/** A function that returns text to be copied */
getText(): string;
/** Callback when the text has been successfully copied */
onClipboardCopy?(copiedText: string): void;
/** Callback when there was an error copying the text */
onClipboardError?(copiedText: string, error: unknown): void;
};
/**
* A control for allowing the user to copy text to their clipboard. Uses native APIs on modern browsers, falling back to the old `document.execCommand('copy')` API on other browsers. The text to be copied should be provided via `getText` prop.
*
* https://developers.grafana.com/ui/latest/index.html?path=/docs/inputs-clipboardbutton--docs
*/
export declare function ClipboardButton({ onClipboardCopy, onClipboardError, children, getText, icon, variant, ...buttonProps }: Props): import("react/jsx-runtime").JSX.Element;