File size: 342 Bytes
a03b3ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<script lang="ts">
	import { BaseButton } from "@gradio/button";
	export let code: string;
	let copy_text = "copy";

	function copy(): void {
		navigator.clipboard.writeText(code);
		copy_text = "copied!";
		setTimeout(() => {
			copy_text = "copy";
		}, 1500);
	}
</script>

<BaseButton size="sm" on:click={copy}>
	{copy_text}
</BaseButton>