Clipboard
Clipboard component.
Clipboard, Customization Blocks
Example:
// AppServiceProvider, "boot" method. TallStackUi::customize() ->clipboard() ->block('block', 'classes');
<x-clipboard text="TallStackUI" /> <!-- Or --> <x-clipboard> TallStackUI</x-clipboard>
<x-clipboard label="Library" hint="Click to copy the library name" text="TallStackUI" />
An option to transform the input in a password type.
<x-clipboard text="TallStackUI" secret />
<x-clipboard x-on:copy="alert(`Copied: ${$event.detail.text}`)"> TallStackUi</x-clipboard>
<x-clipboard text="TallStackUI" icon /> <!-- Or --> <x-clipboard icon> TallStackUI</x-clipboard>
<x-clipboard text="TallStackUI" icon :icons="['copy' => 'pencil', 'copied' => 'check']"/>
An option to copy text using a JavaScript API.
<x-button x-on:click="$tsui.copy('TallStackUI')"> Copy</x-button>
// $tsui.copy resolves to a boolean reporting whether the copy succeeded.const copied = await window.$tsui.copy('TallStackUI'); // It also dispatches the `ts-ui:copy` event on window with the copied text.window.addEventListener('ts-ui:copy', (event) => { alert(`Copied: ${event.detail.text}`); // 'Copied: TallStackUI'});