CKTIS / JavaScript
ClipboardItem — a clipboard item with MIME representations
ClipboardItem describes one clipboard item that can have several MIME representations. Its constructor prepares data; it does not itself write anything to the system clipboard.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
new ClipboardItem(items, options)
item.types
item.getType(type) // Promise<Blob>
ClipboardItem.supports(type)ClipboardItem belongs to Web APIs, not ECMAScript. One object can contain different representations of the same content. Its constructor accepts a nonempty map from MIME types to Blob values, strings, or promises of those values; an empty map throws TypeError.
types exposes the representation types, and getType(type) returns a Promise<Blob>; a missing representation rejects with NotFoundError. Optional presentationStyle accepts "unspecified" (the default), "inline", or "attachment". Static ClipboardItem.supports(type) checks format support, not permissions.
Only navigator.clipboard.write([item]) writes the data; navigator.clipboard.read() reads items. Clipboard access is subject to permission, user-activation, and focus restrictions. The interface requires a secure Window context. Feature-detect the methods you use; the specification is a W3C draft, and Node 24 does not establish browser support.
Examples
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ClipboardItem MIME representation</title>
</head>
<body>
<pre id="result" role="status"></pre>
<script>
async function showItem() {
const result = document.querySelector('#result');
if (typeof globalThis.ClipboardItem !== 'function') {
result.textContent = 'ClipboardItem unavailable';
return;
}
const type = 'text/plain';
const item = new ClipboardItem({
[type]: new Blob(['Hello'], { type })
});
const representation = await item.getType(type);
result.textContent = item.types.join(', ') + '\n' + await representation.text();
}
showItem();
</script>
</body>
</html>Result
ClipboardItem unavailable
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.