bigbullui logobigbullui
Componenteditors

Html Preview

Sandboxed HTML preview frame.

Preview

Live Preview
HTML önizlemesandbox

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add html-preview

Or install the full npm package:

npm install bigbullui

Usage

import { HtmlPreview } from "@/components/ui/html-preview";

<HtmlPreview />

Source code

html-preview.tsx

Zero dependencies (only React + utils). Copy and paste directly into your project:

"use client";

import * as React from "react";
import { cn } from "./lib/utils";

export interface HtmlPreviewProps extends React.HTMLAttributes<HTMLIFrameElement> {
  html: string;
  title?: string;
  height?: string;
}

/** Sandboxed HTML önizleme iframe'i. */
export function HtmlPreview({ html, title = "HTML önizleme", height = "240px", className, ...props }: HtmlPreviewProps) {
  return (
    <div className={cn("overflow-hidden rounded-lg border border-border", className)} {...props}>
      <div className="flex items-center justify-between border-b border-border bg-secondary/60 px-3 py-1.5">
        <span className="font-mono text-[10px] uppercase tracking-wider text-muted-foreground">HTML önizleme</span>
        <span className="rounded-full border border-emerald-500/40 bg-emerald-500/10 px-1.5 py-px font-mono text-[8px] uppercase tracking-wider text-emerald-600">sandbox</span>
      </div>
      <iframe
        title={title}
        srcDoc={html}
        sandbox="allow-scripts"
        style={{ height }}
        className="w-full border-0 bg-white"
      />
    </div>
  );
}

Props

PropTypeDescription
htmlstring
titlestring
heightstring