Navigate a local page preview
Loading preview…
Console (1)
- info ·
Provides URL navigation, a sandboxed iframe and a collapsible console of supplied log messages.
Loading preview…
Loading preview…
npm install @noorddev/vlak-react
Load the stylesheet once at your app root, then import the components you use.
import "@noorddev/vlak-react/css";
import { WebPreview } from "@noorddev/vlak-react";Per-component imports are available at @noorddev/vlak-react/components/web-preview.
npx @noorddev/vlak-cli add web-preview
Adds the component and its dependencies to components/vlak/. Follow the StyleX setup to compile the source in your application.
npx shadcn add https://vlak.dev/r/web-preview.json
Installs the same source through the shadcn CLI.
import { WebPreview } from "@noorddev/vlak-react";
<WebPreview title="Generated page" defaultUrl="about:blank" frameProps={{ height: 320 }} logs={[{ level: "info", message: "Preview ready" }]} />See the integration example to compose these components with your application's model and data.
URL navigation and a sandboxed iframe with host-supplied console messages.
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | "Web preview" | |
url | string | ||
defaultUrl | string | "about:blank" | |
onUrlChange | (url: string) => void | ||
onBack | () => void | ||
onForward | () => void | ||
canGoBack | boolean | false | |
canGoForward | boolean | false | |
onReload | () => void | ||
logs | WebPreviewLog[] | [] | |
maxLogEntries | number | 200 | |
frameProps | Omit<DetailedHTMLProps<IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>, "title" | "children" | "src" | "srcDoc"> | iframe permissions remain application-controlled; scripts and forms are allowed without same-origin access by default. |
Also accepts Omit<HTMLAttributes<HTMLElement>, "title">.
The ref reaches HTMLElement.
| Keys | Does |
|---|---|
| Tab | Tab reaches enabled navigation controls, the address, iframe and console disclosure. |
| Enter, Space | Enter in the address field requests navigation; Enter or Space activates the focused button. |
The same styles are available as CSS. Native HTML provides the static presentation; React or application code supplies state updates and actions.
npm install @noorddev/vlak
import "@noorddev/vlak/css";
<section class="rs-web-preview" aria-label="Calendar preview"><div class="rs-web-preview-body"><iframe class="rs-widget-embed" title="Calendar preview" src="about:blank" sandbox="allow-scripts allow-forms" loading="lazy" referrerpolicy="no-referrer"></iframe></div><p class="rs-web-preview-status" role="status">Preview loaded.</p></section>