Share link
Share link
A link to a print, ready to paste. The button copies it and says so.
import { createCopyButton } from "@reuse-sh/interactions";
import "@reuse-sh/interactions/styles.css";
// <input class="link" value="https://prints.example/coral-sky" readonly />
// <button class="copy-link">Copy link</button>
const input = document.querySelector(".link");
const copy = createCopyButton(document.querySelector(".copy-link"), {
getText: () => input.value,
onError: () => input.select(),
});import { CopyButton } from "@reuse-sh/interactions/react";
import "@reuse-sh/interactions/styles.css";
export function ShareLink({ url }) {
return (
<div className="share">
<input value={url} readOnly aria-label="Link to the print" />
<CopyButton text={url}>Copy link</CopyButton>
</div>
);
}Read https://reuse.sh/copy-button/guide.md and build a share panel that copies its link like https://reuse.sh/copy-button/examples/share-link. Keep the principles the guide lists.