Published
Edited
Sep 18, 2021
Importers
24 stars
Insert cell
Insert cell
Insert cell
Copier("Click me!", {value: "Hello, world!"})
Insert cell
Copier([
["1", "I have eaten the plums that were in the icebox"],
["2", "and which you were probably saving for breakfast"],
["3", "Forgive me they were delicious so sweet and so cold"]
], {label: "Snippets"})
Insert cell
Insert cell
{
let count = 0;
return Object.assign(
html`<button>Click me to copy text!`,
{onclick: () => pbcopy(`Hello, world! ${++count}`)}
);
}
Insert cell
pbcopy = text => navigator.clipboard.writeText(text)
Insert cell
function Copier(content = "Copy code", options) {
if (Array.isArray(content)) content = Array.from(content, ([key, value]) => [key, () => (pbcopy(value), value)]);
return Inputs.button(content, {...options, reduce: (value) => (pbcopy(value), value)});
}
Insert cell
copy = pbcopy // Deprecated alias
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more