Browser frame

A light browser window with a centred address and an optional footer.

northwind.io
GET /take?url=northwind.io

Install

$ npx shadcn@latest add @nudgekit/browser-frame

Or with no config: npx shadcn@latest add https://ui.nudgekit.app/r/browser-frame.json

Usage

usage.tsx
import { BrowserFrame } from "@/components/browser-frame"

<BrowserFrame url="northwind.io" footer={<div className="px-4 py-3 font-mono text-xs">GET /take?url=northwind.io</div>}>
  <img src="/shot.webp" alt="Captured page" />
</BrowserFrame>

Do

  • Use for product screenshots and website previews.

Don't

  • Add colourful traffic-light dots; they stay grey.

Code

What the CLI writes into your project. It is yours to change.

components/browser-frame.tsx
import * as React from "react";

import { cn } from "@/lib/utils";

export interface BrowserFrameProps extends React.HTMLAttributes<HTMLDivElement> {
  /** The address shown in the bar, without https://. */
  url?: string;
  /** Content under the page, for example the API request that made the capture. */
  footer?: React.ReactNode;
}

/** A light browser window: three grey dots, a centred address, then the page. Hairline, no shadow. */
function BrowserFrame({ url = "example.com", footer, className, children, ...props }: BrowserFrameProps) {
  return (
    <div data-slot="browser-frame" className={cn("overflow-hidden rounded-card border border-border bg-background", className)} {...props}>
      <div className="flex items-center gap-1.5 border-b border-border px-3 py-2.5">
        <span className="size-[9px] rounded-full bg-line-strong" />
        <span className="size-[9px] rounded-full bg-line-strong" />
        <span className="size-[9px] rounded-full bg-line-strong" />
        <span className="mx-auto -translate-x-3.5 rounded-md bg-surface px-10 py-0.5 font-mono text-xs text-faint">{url}</span>
      </div>
      {children}
      {footer && <div className="border-t border-border">{footer}</div>}
    </div>
  );
}

export { BrowserFrame };