phonograph/svelte/src/copy-source.webc.svelte
2025-11-13 05:20:05 +00:00

33 lines
506 B
Svelte

<svelte:options
customElement={{
props: { copy_data: { attribute: "copy-data" } },
tag: "copy-source",
}}
/>
<script lang="ts">
type Props = {
copy_data?: string;
};
let { copy_data }: Props = $props();
</script>
<button
class="click-target"
onclick={() => {
navigator.clipboard.writeText(copy_data);
}}
type="button"
>
<slot></slot>
</button>
<style>
.click-target {
appearance: none;
background: none;
border: none;
cursor: pointer;
}
</style>