This would be a great feature. Maybe as one of the options in the cell’s pop-up menu:
For now, I’m using @mbostock’s suggestion and creating a new cell with a button:
Inputs.button("Copy to clipboard", {
value: null,
reduce: () =>
navigator.clipboard.writeText(JSON.stringify(theVariableYouWantToCopy)),
});