Skip to content

MIDDAG React UIContract-driven components for Moodle & WordPress

The backend sends a PageContract JSON object. The frontend renders it. No manual wiring needed.

Quick Overview

ts
import { ContractPage, registerDefaults } from '@middag-io/react';
import '@middag-io/react/style.css';

// Register all built-in shells, layouts, and blocks
registerDefaults();

// Render a page from a contract
<ContractPage contract={contract} />

The rendering pipeline:

Backend (PHP)  -->  Inertia  -->  ContractPage  -->  Shell  -->  Layout  -->  Blocks

Architecture

LayerDescription
ShellOutermost wrapper (sidebar, header, navigation)
LayoutRegion arrangement inside the shell (stack, sidebar, dashboard, wizard)
BlockAtomic rendering unit placed in a layout region
ProviderReact context bridges for i18n, auth, flash, scope, progress

Install

bash
# Community — wizard auto-detects your host and scaffolds ui/
npx create-middag-ui

# PRO — source maps, mock SPA, full exports
npx @middag-io/create-middag-ui

# Then:
cd ui && npm install && npm run dev:mock

Or install manually: npm install @middag-io/react (see Getting Started for auth setup).

CLI

CommandDescription
npx create-middag-uiBootstrap ui/ (Community)
npx @middag-io/create-middag-uiBootstrap ui/ (PRO)
npx @middag-io/react doctorValidate consumer project setup
npx @middag-io/react devStart mock dev server
npx @middag-io/react add-block <type>Scaffold a new block type
npx @middag-io/react upgradeCheck for updates and run codemods

See CLI Reference for details.

MIDDAG © 2015-2026