my_gradio / js /_website /src /lib /icons /CopyButton.svelte
xray918's picture
Upload folder using huggingface_hub
0ad74ed verified
raw
history blame contribute delete
412 Bytes
<script lang="ts">
import { svgCopy, svgCheck } from "$lib/assets/copy.js";
export let content: string = "";
let copied = false;
async function copy() {
await navigator.clipboard.writeText(content);
copied = true;
setTimeout(() => (copied = false), 2000);
}
</script>
<button on:click={copy} role="button" tabindex={0}>
{#if !copied}
{@html svgCopy}
{:else}
{@html svgCheck}
{/if}
</button>