Open this example in the interactive library
Live preview
Source code
// components/JSONExportLink.tsx
export default function JSONExportLink({
filename = "notes.txt",
text = "Studio notes",
}: { filename?: string; text?: string } = {}) {
const json = JSON.stringify({ filename, text }, null, 2);
return (
<a download="notes.json" href={"data:application/json," + encodeURIComponent(json)}>
Export JSON
</a>
);
}
