Clipboard
Copy and paste plain text.
@ink/clipboard reads and writes plain text through Android’s clipboard.
Copy text
Place this component inside a Screen.
import { Button, Text, useAction } from "ink";
import { clipboard } from "@ink/clipboard";
export function CopyReference({ value }: { value: string }) {
const copy = useAction(() => clipboard.writeText(value));
return <>
<Button onPress={() => copy.run()}>Copy reference</Button>
{copy.status === "success" && <Text>Copied</Text>}
{copy.status === "error" && <Text>Could not copy reference</Text>}
</>;
}

Paste text
import { clipboard } from "@ink/clipboard";
const text = await clipboard.readText();
The result is text, or null if none is available.
Privacy
Repeated background reads can trigger Android privacy notices.
Validate pasted URLs, codes and records before using them. Avoid copying credentials.

