Skip to content

Frontend SDK, Styling & UI Showcase

Downstream modules never bundle their own copy of React, Inertia, or Base UI. Instead, they import from the typed @pw/react/* SDK, which maps at build time onto window.ReactWorkspaceRuntime exposed by dist/ReactInertia.js.

SDK Subpath Key Exports
@pw/react/core React, ReactDOM, ReactDOMClient, Inertia (Link, Head, router, usePage, visitSameModuleHref), registerPages, registerIslands, registerViewport, loadRuntimeScript, loadRuntimeStyle, preloadRuntimeScript, cn, DynamicIcon, URL sanitizers
@pw/react/ui Accessible Base UI primitives (Button, Badge, Card, Dialog, Sheet, Drawer, Tabs, Table, Toast, CommandDialog, StatCard, CliBox, EmptyState, ConfirmDialog)
@pw/react/layout AppShell, RecordHeader, EditPresenceBanner, ModuleSwitcher, UserAccountMenu, SidebarShellLayout, useSidebarCollapsed, useEditPresence, postWorkspacePreferenceAction, renderNoticeMarkup
@pw/react/viewports DataViewport, DataTableCanvas, DataCardsCanvas, viewport registries, and cell helpers
@pw/react/fields SchemaForm, SchemaField, ConditionBuilder, all lazy field controls (Color, Tags, Combobox, Phone, UnitNumber, Segmented, Spacing, Otp, Password, Markdown, File, Image, Icon, Link, KeyValue, Relation), FieldControlIsland, ExtraFieldControlIsland
@pw/react/hooks useTranslations, t, translate, useTheme, THEME_PRESETS, fetchGatewayJson, useDirtyFormBridge, useUnsavedChangesGuard, useEditPresence, KeyboardShortcutsProvider, useKeyboardShortcuts, formatShortcutKeys
@pw/react/dnd, @pw/react/grid, @pw/react/calendar Lazy wrappers for sortable lists/trees (ReactDnd), virtual data grid (ReactGrid), and calendar/date pickers (ReactCalendar)
@pw/react/optional Safe runtime lookup helpers (getOptionalReactRuntime, requireReactRuntime)

Isolated Bundles & module-delta.css (39 Cascade Sub-Layers)

Section titled “Isolated Bundles & module-delta.css (39 Cascade Sub-Layers)”

Use the root vite.module.ts (defineWireModuleConfig) helper to build each companion Process*, Inputfield*, or Markup* entry into its own self-contained IIFE under dist/<Module>.js with zero shared chunk emissions (ReactInertia-*.js) and zero *.style.js leftovers.

For Tailwind CSS v4 utilities in downstream modules:

  1. Import React/resources/css/module-delta.css (@tailwind utilities source(none);) with zero Preflight reset so ProcessWire’s AdminThemeUikit stays intact.
  2. createTailwindCascadeLayersPlugin() partitions utilities across 39 deterministic @layer utilities.* sub-layers (shorthand, axis, longhand, state, responsive sm-* through xxl-*, container queries container-3xs through container-7xl, container, and media) identically across both ReactInertia.css and downstream module CSS so late-loaded stylesheets never clobber responsive or dark-mode classes.
  3. Consume semantic --pw-* CSS variables and opt into typography or table isolation using [data-rw-prose-root] and [data-rw-table].

Built-In UI Showcase Studio (/admin/workspace/ui-showcase/)

Section titled “Built-In UI Showcase Studio (/admin/workspace/ui-showcase/)”

When $config->debug = true and ProcessReactWorkspace is installed, superusers can open UI Showcase from the Workspace header (or navigate directly to <adminUrl>workspace/ui-showcase/).

The studio lets you inspect all 7 interactive sections (media, links, relations, datetime, contexts, controls, primitives, plus all) across responsive viewport presets (Direct, 1280px, 768px, 420px, 375px, and side-by-side Compare 375/420/768), theme modes (Auto, Light, Dark), and an automated horizontal overflow check (Check Overflow).

The debug-only UI Showcase studio tests all 7 component sections across responsive breakpoints, overflow checks, and light/dark themes.

You can also deep-link directly to any section or theme with query parameters:

  • ?section=media|links|relations|datetime|contexts|controls|primitives|all
  • ?theme=auto|light|dark
  • ?embed=1 (renders only the isolated section canvas without the studio toolbar)

All UI primitives (Dialog, Sheet, Popover, Tabs, CommandDialog, Select, Combobox) are built on @base-ui/react with keyboard roving focus, ARIA attributes, high-contrast light and dark tokens, and Escape dismissal.

Next steps