@stacksjs/stx
Version:
A performant UI Framework. Powered by Bun.
34 lines • 821 B
TypeScript
/**
* Create a clipboard helper
*
* @example
* ```ts
* const clipboard = useClipboard()
*
* // Copy text
* await clipboard.copy('Hello World')
*
* // Check if copy was successful
* if (clipboard.copied) {
* console.log('Copied!')
* }
* ```
*/
export declare function useClipboard(options?: { timeout?: number }): ClipboardRef;
/**
* Copy text to clipboard (one-shot helper)
*/
export declare function copyToClipboard(text: string): Promise<boolean>;
/**
* useClipboard - Reactive clipboard composable
*
* Provides easy access to the Clipboard API with fallbacks.
*/
export declare interface ClipboardRef {
text: string
isSupported: boolean
copied: boolean
copy: (text: string) => Promise<boolean>
read: () => Promise<string>
subscribe: (callback: (text: string) => void) => () => void
}