Skip to content

Data display

Preview frame

A sandboxed live preview of a rendered resume, scaled to fit.

import { PreviewFrame } from '@jsonresume/ui'Source(opens in a new tab)

Examples

Rendered resume
preview-frame/resume.tsx
'use client';

import { PreviewFrame } from '@jsonresume/ui';

const html = `<!doctype html><html><body style="font-family: Georgia, serif; padding: 48px 56px; color: #202020">
<h1 style="text-align:center; font-weight:600; margin:0">Richard Hendriks</h1>
<p style="text-align:center; color:#4b4b4b">Programmer · richard@piedpiper.com</p>
<h2 style="font-size:18px; border-bottom:1px solid #b8b8b2; padding-bottom:4px">Experience</h2>
<p><strong>CEO</strong> · Pied Piper · 2013 – 2014</p>
<p>Built a middle-out compression algorithm.</p></body></html>`;

// In the registry, srcDoc is the rendered theme or src is the resume URL.
export default function PreviewFrameResume() {
  return (
    <PreviewFrame
      title="Resume preview, Pro theme"
      srcDoc={html}
      height={420}
    />
  );
}

Accessibility

  • The iframe has a title; scripts are off unless allowScripts is set.

Props

<PreviewFrame>

Also accepts the attributes of the element PreviewFrame renders.
PropTypeDefaultDescription
title requiredstring–Accessible name: "Resume preview, Pro theme".
allowScriptsbooleanfalseRendered themes don't need scripts; enable only for trusted content.
heightnumber560Visible height in px.
pageWidthnumber794Page width the content is laid out at (A4 at 96dpi by default); it scales to fit.
srcstring–A URL to load…
srcDocstring–…or an HTML document to render.