Copy to Clipboard
Click to copy text to clipboard with visual feedback
npm install laravel-corekit
php artisan migrate
npm run dev
git clone https://github.com/user/repo.git
Code
<div x-data="{ copied: false }">
<div class="flex items-center gap-2">
<input type="text" value="https://example.com/share/abc123" readonly class="flex-1 px-3 py-2 border rounded-lg">
<button @click="
navigator.clipboard.writeText($el.previousElementSibling.value);
copied = true;
setTimeout(() => copied = false, 2000);
" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition">
<span x-show="!copied">Copy</span>
<span x-show="copied" x-cloak>Copied!</span>
</button>
</div>
</div>
QR Code Generator
Generate QR codes using external API
Code
<div x-data="{ url: 'https://example.com', qrUrl: '' }" x-init="qrUrl = `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(url)}`">
<input type="text" x-model="url" @input="qrUrl = `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(url)}`" placeholder="Enter URL" class="w-full px-3 py-2 border rounded-lg mb-4">
<div class="flex justify-center">
<img :src="qrUrl" alt="QR Code" class="border rounded-lg p-2 bg-white">
</div>
</div>
Export to CSV
Export data to CSV file for download
| Name | Role | Status | |
|---|---|---|---|
| John Doe | john@example.com | Admin | Active |
| Jane Smith | jane@example.com | User | Active |
| Bob Johnson | bob@example.com | Editor | Pending |
Code
<button @click="
const data = [
['Name', 'Email', 'Role'],
['John Doe', 'john@example.com', 'Admin'],
['Jane Smith', 'jane@example.com', 'User']
];
const csv = data.map(row => row.join(',')).join('\n');
const blob = new Blob([csv], { type: 'text/csv' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'export.csv';
a.click();
" class="px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700">
Export to CSV
</button>