The Visual Page Builder SDK

Drop a full drag-and-drop page editor into any web app. One component, zero config. React, Next.js, or Vanilla JS.

$npm install @pagehub/sdk

Quick Start

Get a full editor running in under a minute.

One React component. Pass your save/load callbacks and you're done. Full editor with drag-and-drop, theming, and responsive preview.

SSR note: In Next.js, wrap with dynamic(() => import('./Builder'), { ssr: false })

Builder.tsx
import { PageHubEditor } from "@pagehub/sdk";
import "@pagehub/sdk/editor.css";

export default function Builder() {
  return (
    <PageHubEditor
      callbacks={{
        onLoad: async () => {
          const res = await fetch("/api/pages/home");
          return res.ok ? res.json() : null;
        },
        onSave: async (pageData) => {
          await fetch("/api/pages/home", {
            method: "PUT",
            body: JSON.stringify(pageData),
          });
        },
      }}}
      theme={{ primaryColor: "#2563eb" }}
    />
  );
}

Everything you need

A complete page builder, not a toy widget.

Visual Canvas

Full drag-and-drop editing with real-time preview. No iframe, no shadow DOM — just React.

18+ Components

Text, Image, Button, Form, Video, Nav, Footer, and more — all responsive out of the box.

Responsive Preview

Switch between desktop, tablet, and mobile views. Components adapt automatically.

Theming

Full palette control, Google Fonts, CSS variables, dark/light mode. White-label ready.

Static HTML Export

Render pages to HTML on the server. No React, no browser. Works in Node and edge workers.

AI Assistant

Built-in AI content generation and editing. Powered by PageHub Cloud.

Lightweight Viewer

Separate viewer bundle for published pages. Smaller than the editor, zero editing UI.

Import / Export

JSON import/export for page data. Programmatic save, load, and manipulation.

Form Builder

Drag-and-drop form elements with validation, submission handling, and custom fields.

Built-in Components

18 drag-and-drop components out of the box. Add your own via the resolver.

ContainerFlex/grid layout wrapper
TextRich text with inline editing
ImageResponsive images
ButtonCTA with variants
FormForm container
VideoYouTube, Vimeo, self-hosted
HeaderPage header with nav
FooterPage footer
DividerHorizontal rule
SpacerVertical spacing

+ ImageList, ButtonList, ContainerGroup, Audio, Embed, Background, FormElement, Nav

Instance API

Programmatic control when you need it.

api.ts
const editor = PageHub.init({ ... });

// Save & load
editor.save({ isDraft: true });
editor.load("page-id");
editor.getPageData(); // { content, html, classes }

// HTML export
editor.getHTML();
editor.exportJSON();
editor.importJSON(json);

// Runtime updates
editor.setReadOnly(true);
editor.setTheme({ primaryColor: "#e11d48" });

// Events
const off = editor.on("save", (data) => {}); 
editor.destroy();

Events

readyEditor mounted and ready
saveUser or programmatic save
loadPage loaded
changeEditor state changed (debounced)
errorSomething went wrong
modeChangeRead-only toggled

Tailwind-Native Theming

v4

Not a proprietary system — just CSS variables and Tailwind utilities. Your design system, your rules.

Tailwind v4 runtime.

Compiled in the browser with @tailwindcss/browser. Arbitrary values, zero config.

Shadcn / TweakCN tokens.

Standard semantic variables (--primary, --background, --muted, …). Drop in a TweakCN export or theme file and the whole editor follows.

Automatic dark mode.

CSS variable swapping. No class duplication, no JS toggling required.

/* One file. Every component updates. */

:root {
  --primary: hsl(220 57% 59%);
  --primary-foreground: hsl(0 0% 100%);
  --secondary: hsl(210 40% 96%);
  --accent: hsl(210 40% 96%);
  --background: hsl(0 0% 100%);
  --foreground: hsl(0 0% 6%);
  --muted: hsl(210 31% 95%);
  --border: hsl(214 32% 91%);
  --radius: 0.5rem;
  --font-sans: "Inter", system-ui, sans-serif;
}

.dark {
  --background: hsl(0 0% 20%);
  --foreground: hsl(0 0% 91%);
  /* ... all vars swap automatically */
}

Drop-in Themes

One CSS file swaps the entire look. Compatible with shadcn/ui and TweakCN.

Google Fonts

Heading + body font pairs injected automatically. 1,500+ fonts available.

White-Label Ready

Per-tenant theme injection. Each client gets their own design system.

Built onTailwind CSS v4·CSS Custom Properties·Google Fonts·shadcn/ui·TweakCN

Static HTML Renderer

Render pages to HTML on the server. No React, no browser required. Works in Node.js and edge workers.

render.ts
import { renderToHTML } from "@pagehub/sdk/static-renderer";

// From compressed content (what onSave gives you)
const { html, classes, fontUrls } = renderToHTML(savedContent);

// Full standalone document
const { html } = renderToHTML(savedContent, {
  document: true,
  title: "My Page",
});

Works offline. Scales with Cloud.

The core editor works standalone. Cloud features are optional.

Free
Drag-and-drop editorWorks standalone
Free
Viewer & static rendererWorks standalone
Free
Custom componentsPass via resolver
Free
Theming & white-labelFull CSS control
Cloud
AI content generationRequires PageHub account
Cloud
Image CDN & uploadsOr provide onMediaUpload

Start building

One install. One component. Full page builder.

$npm install @pagehub/sdk