Skip to content
trkPublic

About

Shared React 19 + Inertia v3 + Tailwind CSS v4 runtime, admin shell, form controls, media studio, rich text editor, interactive data viewports, and optional Workspace Hub for ProcessWire.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

111 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React for ProcessWire

PHP 8.4+ ProcessWire 3.0.271+ React 19 Inertia v3 Tailwind CSS v4 License: MIT

A shared React 19, Inertia.js v3, and Tailwind CSS v4 UI runtime for ProcessWire 3. Build dual-context admin workspaces, interactive data tables and cards, modern media and relational fields, rich text editing, and vector icon pickers without duplicating frontend infrastructure across modules.

Quick Start · What's Included · Configuration · Documentation · API Reference

React for ProcessWire preview

Note

Installing React adds zero top-level admin menu items. An Admin > Workspace launcher appears only when you also install the optional ProcessReactWorkspace module.


At a Glance

  • Shared Modern UI Runtime: Ships React 19, Inertia v3, and Tailwind CSS v4 with isolated dist/ bundles loaded strictly on demand.
  • Dual-Context Admin Workspaces: Author a ProcessReact module once and run it both inside native Setup > <Module> and full-screen in the optional Admin > Workspace hub with the collapsible Sidebar navigation shell.
  • Native Theme Alignment: Maps ProcessWire --pw-* admin color variables automatically, with built-in presets, dark mode, and custom CSS token overrides.
  • 15 Built-in UI Controls: Interactive tables and cards, Tiptap v3 rich text editor, media upload/crop studio, relational pickers, polymorphic links, condition builder, tabs, key-value, and 6,545 vector icons.
  • Zero-Cost Lazy Extensions: Downstream modules register workspaces, data providers, command search sources, and controls on demand with zero overhead on unrelated requests.
  • Hardened & Localized: Enforces CSRF checks, user-bound HMAC-SHA256 tokens, strict JSON payload bounds, and 6 built-in language packs (en, tr, de, fr, es, ru).

How It Works

flowchart LR
    PW["ProcessWire Admin & Templates"] --> CORE["React Runtime & Theme Tokens"]
    CORE --> WS["Admin Workspaces (ProcessReact)"]
    CORE --> VP["Interactive Viewports (Table & Cards)"]
    CORE --> IF["Modern Inputfields (Tiptap, Media, Relations, Icons)"]
    WS --> DIST["Isolated On-Demand dist/ Bundles"]
    VP --> DIST
    IF --> DIST
Loading

Requirements & Installation

  • PHP: >= 8.4
  • ProcessWire: >= 3.0.271
  • Required Module: Inertia (Totoglu\Inertia)
composer require trk/processwire-react
php vendor/bin/wire module:install --name=React --json

# Optional: add the unified Admin > Workspace hub and cross-module switcher
php vendor/bin/wire module:install --name=ProcessReactWorkspace --json

What's Included

Installing React automatically installs 15 companion modules (ProcessReactWorkspace remains optional):

Category Companion Modules What It Provides Guide
Data Viewports MarkupReactTable, MarkupReactCards Sortable, filterable, inline-editable table and responsive card viewports. 04 — Viewports
Rich Text InputfieldTiptap, TextformatterTiptapMiniBlocks Tiptap v3 rich text editor with native ProcessWire link/image modals and flat mini-blocks. 03 — Tiptap
Media Studio InputfieldReactImage, InputfieldReactFile Dropzone upload studio with crop/focus/rotate/flip tools, palette inspection, and multi-language metadata. 03 — Media Studio
Relational Pickers InputfieldReactM2O, M2M, O2M, M2A Async search and tree pickers backed by 8 core ProcessWire resource adapters and custom adapters. 03 — Relations
Form & Rule Controls MarkupReactTab, InputfieldReactKeyValue, InputfieldReactLink, InputfieldReactCondition Accessible tabs, key-value pairs, polymorphic link picker, and visual AND/OR/NOT condition rule builder. 03 — Controls
Vector Icons InputfieldReactIcon Searchable 6,545-variant vector icon picker (outline and filled) plus admin template/field icons. 03 — Vector Icons

Quick Start

1. Build a Dual-Context Admin Module

Extend ProcessReact to render a single React view inside Setup > Catalog and full-screen inside Admin > Workspace (?ws=1). See 02 — Workspaces & Admin Shell for layout and navigation options.

<?php

declare(strict_types=1);

namespace ProcessWire;

use Totoglu\React\Icon\IconManager;
use Totoglu\React\Inertia\ProcessReact;

class ProcessCatalog extends ProcessReact
{
	public function init(): void
	{
		parent::init();

		IconManager::registerAdminIcons(['layout-dashboard', 'shopping-bag']);

		React::deferModuleRegistration(
			$this,
			function (React $react): void {
				$react->workspaces()->register([
					'id' => 'catalog',
					'title' => $this->_('Catalog'),
					'description' => $this->_('Manage products, pricing tiers, and inventory.'),
					'icon' => 'shopping-bag',
					'process' => 'ProcessCatalog',
					'component' => 'Catalog/Workspace',
					'permission' => 'catalog-view',
				]);
			}
		);
	}

	/**
	 * @param array<string, mixed> $options
	 * @return string|array<string, mixed>
	 */
	public function ___executeNavJSON(array $options = []): string|array
	{
		if (!$this->wire()->user->hasPermission('catalog-view')) {
			throw new WirePermissionException($this->_('Access denied.'));
		}

		return $this->buildAdminNavJSON([
			['url' => '', 'label' => $this->_('Overview'), 'icon' => 'layout-dashboard'],
			['url' => 'products/', 'label' => $this->_('Products'), 'icon' => 'shopping-bag', 'separator' => true],
		], $options);
	}

	public function ___execute(): string
	{
		$react = React::instance($this);

		return (string) $this->inertiaRender('Catalog/Workspace', [
			'table' => $react->configureTable('pages:template=product, limit=25', [
				'title' => $this->_('Products'),
				'columns' => [
					'title' => $this->_('Title'),
					'modified' => $this->_('Modified'),
					'status' => $this->_('Status'),
				],
				'sortableColumns' => ['title', 'modified', 'status'],
				'quickEditEnabled' => true,
				'exportEnabled' => true,
			]),
		]);
	}
}

2. Render a Standalone Interactive Table

Embed an interactive table in any classic admin screen or frontend template (04 — Viewports & Data Providers):

<?php

declare(strict_types=1);

namespace ProcessWire;

$react = React::instance($this);

echo $react->renderTable('pages:template=basic-page, limit=20', [
	'title' => $this->_('Site Pages'),
	'columns' => [
		'title' => $this->_('Title'),
		'path' => $this->_('Path'),
		'modified' => $this->_('Modified'),
		'status' => $this->_('Status'),
	],
]);

3. Render Vector Icons in Templates

Attach InputfieldReactIcon to any FieldtypeText field or render icons directly via IconManager (03 — Vector Icons):

<?php

declare(strict_types=1);

namespace ProcessWire;

/** @var Page $page */
$icon = $page->hero_icon; // ReactIconValue when $page->of(true)
if (!$icon->isEmpty()) {
	echo $icon;
}

echo React::instance($this)->icons()->renderSvg('sparkles', [
	'variant' => 'filled',
	'size' => 24,
	'color' => '#0d9488',
]);

Configuration

Configure site-wide defaults under Modules > Configure > React (React.module.php):

Setting Type Default Description
defaultTheme string 'system' Default color mode (system, light, or dark).
themePreset string 'native' Visual preset (native, neutral, slate, stone, ocean, indigo, teal, or custom).
themeCustomTokens string '' Sanitized :root and .dark CSS variables used when themePreset is custom.
enableKeyboardShortcuts bool true Enables Cmd/Ctrl+K command search, Cmd/Ctrl+B sidebar toggle, ? help, and save hotkeys.
adminReturnLabel string 'Panel' Localized top-left return label in Workspace mode.
useReactMediaFields bool false Upgrades standard page InputfieldImage and InputfieldFile fields to the React media studio.
enableAdminVectorIcons bool true Adds the vector icon picker on Edit Template and Edit Field screens.
adminIconPreviewSize int 28 Preview icon size in pixels (16–64) in template and field editors.

Tip

Authenticated users can override theme mode, color preset, shell layout, and collapsed sidebar state from the Workspace account menu. See 02 — Centralized Theme Engine.


Extensibility & Gateways

Downstream modules integrate lazily via 'autoload' => false and 'reactCapabilities' => [...] pull-discovery, so unrelated requests pay zero boot cost. Client components communicate through eight authenticated /_react/* gateways.

Hookable methods & lazy registration helpers
  • Hookable React Methods: ___registerWorkspaces(), ___registerWidgets(), ___registerCommandSearch(), ___registerProviders(), ___registerRelationResources(), ___registerMediaHosts(), ___registerViewportModes(), ___registerLinkResolvers(), ___translations().
  • Deferred Helpers: React::deferModuleRegistration(), deferCommandSearchRegistration(), deferProviderRegistration(), deferRelationRegistration(), deferMediaHostRegistration(), deferViewportModeRegistration(), deferLinkResolverRegistration(), and React::forgetSharedViewportMode().
  • Rich Text Mini-Blocks: InputfieldTiptap::registerMiniBlocks for adding custom flat [data-tiptap-block] renderers under ./site/templates/tiptap/{name}.php.
  • Full Signatures: See API.md.
Internal HTTP gateways (/_react/*)

Registered in React.module.php:

Endpoint Purpose
/_react/viewport Signed table/cards queries, inline edits, bulk actions, saved views, and exports.
/_react/workspace-prefs Per-user favorites, Bento grid layout, theme mode/preset, and shell layout preferences.
/_react/presence Concurrent co-editor heartbeats and remote-save staleness warnings.
/_react/relation Signed relational search, tree loading, hydration, and O2M actions.
/_react/media Signed multipart uploads, replacements, image transforms, and palette inspection.
/_react/tiptap Signed page/file/anchor lookup and Pageimage upload/variation gateway.
/_react/icons Read-only GET paginated icon search and hydration.
/_react/command-search Read-only GET RBAC-scoped command palette search.

Documentation

What You Want to Do Start Here
Browse all guides by role or task Documentation Hub
Build a dual-context admin workspace or customize themes 02 — Workspaces, Dual-Context Shell & Themes
Use Tiptap, Media Studio, Relations, Icons, Links, or SchemaForm 03 — Inputfields, Forms & Rich Text
Render interactive tables, cards, or custom data providers 04 — Viewports & Data Providers
Bundle downstream TypeScript with @pw/react/*, i18n, or audit security 05 — Frontend Runtime, Typed SDK, i18n & Security
Understand system architecture, build pipeline, and ADRs Architecture Overview · 01 — Deep-Dive
Look up exact PHP signatures, contracts, and dist/ bundles API Reference
Review contributor invariants before editing React itself AGENTS.md

Security & Verification

Important

State-changing /_react/* requests require an authenticated user, $session->CSRF validation, POST enforcement, demo-mode checks, 2 MiB / depth-64 JSON limits, and user-bound HMAC-SHA256 signed tokens with 24-hour TTL. See 05 — Security Architecture.

Contributor verification commands

Run sequentially from the repository root:

composer --working-dir=site/modules/React validate --strict --no-check-publish --no-check-version
./vendor/bin/phpstan analyse -c site/modules/React/phpstan.neon --no-progress --memory-limit=1G
npm --prefix site/modules/React run build
npm --prefix site/modules/React run test:unit
php vendor/bin/wire test site/modules/React/tests --json
php vendor/bin/wire test:e2e --module=React --json
php vendor/bin/wire boost:validate --module=React --strict --json

About

Shared React 19 + Inertia v3 + Tailwind CSS v4 runtime, admin shell, form controls, media studio, rich text editor, interactive data viewports, and optional Workspace Hub for ProcessWire.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages