@arolariu/components
Version:
🎨 70+ beautiful, accessible React components built on Base UI. TypeScript-first, CSS Modules styling, tree-shakeable, SSR-ready. Perfect for modern web apps, design systems & rapid prototyping. Zero config, maximum flexibility! ⚡
41 lines • 1.44 kB
TypeScript
import * as React from "react";
/**
* Represents the configurable props for the {@link CopyButton} component.
*
* @remarks
* Extends native `<button>` attributes while reserving `children` for the internal icon
* swap and exposing a required clipboard value.
*/
interface CopyButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
/**
* The text value copied to the clipboard when the button is activated.
*/
value: string;
/**
* Duration in milliseconds to show the success state before restoring the copy icon.
*
* @default 2000
*/
timeout?: number;
}
/**
* A compact icon button that copies text to the clipboard.
*
* @remarks
* **Rendering Context**: Client component.
*
* Uses `navigator.clipboard.writeText` when available and swaps from a copy icon to a
* confirmation icon for a configurable duration after a successful copy. If clipboard
* access fails, the button remains interactive without throwing to the UI.
*
* @example
* ```tsx
* <CopyButton value="npm install @arolariu/components" />
* ```
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText | MDN Clipboard.writeText}
*/
declare const CopyButton: React.ForwardRefExoticComponent<CopyButtonProps & React.RefAttributes<HTMLButtonElement>>;
export { CopyButton };
export type { CopyButtonProps };
//# sourceMappingURL=copy-button.d.ts.map