Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Autocomplete
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Checkbox Group
- Collapsible
- Combobox
- Command
- Context Menu
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Fieldset
- Form
- Frame
- Group
- Input
- Input Group
- Kbd
- Label
- Menu
- Menubar
- Message
- Meter
- Number Field
- OTP Field
- Pagination
- Popover
- Preview Card
- Progress
- Questionnaire
- Radio Group
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Toolbar
- Tooltip
Shared
- Artifact
- Audio Player
- Canvas
- Chain of Thought
- Checkpoint
- Code Block
- Commit
- Connection
- Context
- Controls
- Edge
- Environment Variables
- Mic Selector
- Model Selector
- Node
- Node Toolbar
- Open in Chat
- Panel
- Plan
- Prompt Input
- Queue
- Reasoning
- Sandbox
- Schema Display
- Shimmer
- Snippet
- Sources
- Speech Input
- Stack Trace
- Suggestion
- Tool
- Transcription
- Web Preview
Hooks
Resources
Web Preview
An embedded browser frame with a console.
import {
WebPreview,
WebPreviewBody,
WebPreviewConsole,
WebPreviewNavigation,
WebPreviewNavigationButton,
WebPreviewUrl,
} from "@/registry/default/shared/web-preview";
const logs = [
{
level: "log" as const,
message: "Compiled successfully",
timestamp: new Date(0),
},
{
level: "warn" as const,
message: "Image is missing an alt attribute",
timestamp: new Date(0),
},
{
level: "error" as const,
message: "Failed to fetch /api/session",
timestamp: new Date(0),
},
];
export default function Particle() {
return (
<div className="h-80 w-full">
<WebPreview defaultUrl="https://example.com">
<WebPreviewNavigation>
<WebPreviewNavigationButton tooltip="Back">←</WebPreviewNavigationButton>
<WebPreviewNavigationButton tooltip="Forward">→</WebPreviewNavigationButton>
<WebPreviewUrl />
</WebPreviewNavigation>
<WebPreviewBody />
<WebPreviewConsole logs={logs} />
</WebPreview>
</div>
);
}
Installation
pnpm dlx shadcn@latest add @frontal-labs/web-preview
Usage
import {
WebPreview,
WebPreviewNavigation,
WebPreviewNavigationButton,
WebPreviewUrl,
WebPreviewBody,
WebPreviewConsole,
} from "@/components/web-preview";API Reference
| Export | Props |
|---|---|
WebPreview | <div> attributes, plus its own options |
WebPreviewNavigation | <div> attributes |
WebPreviewNavigationButton | Button props, plus its own options |
WebPreviewUrl | Input props |
WebPreviewBody | <iframe> attributes, plus its own options |
WebPreviewConsole | <div> attributes, plus its own options |
Open the source under Manual above for the exact prop types.
On This Page