Skip to content

5-Minute Quickstart

This walkthrough creates a feature_banner block blueprint and renders it cleanly on a ProcessWire page.

  1. Create site/blocks/feature_banner.yaml

    title: Feature Banner
    description: Highlighted callout banner with primary action link.
    icon: speakerphone
    category: Marketing
    role: element
    blockMode: single
    allowedParents: [row]
    presettable: true
    dynamic: true
    advanced: true
    allowWidth: true
    colSpan: 12
    tabs:
    content:
    label: Content
    fields:
    heading:
    type: text_language
    label: Heading
    required: true
    summary:
    type: textarea_language
    label: Summary
    '@fieldset:content_link': ~
    settings:
    label: Settings
    fields:
    tone:
    type: select
    label: Visual Tone
    default: default
    colSpan: 6
    options:
    default: Default Surface
    brand: Primary Brand
    inverted: Inverted Dark
  2. Expose blocks from site/classes/DefaultPage.php (for React / Inertia)

    <?php
    declare(strict_types=1);
    namespace ProcessWire;
    use Totoglu\Inertia\InteractWithInertia;
    class DefaultPage extends Page
    {
    use InteractWithInertia;
    /**
    * @return array<string, mixed>
    */
    public function inertiaWithData(): array
    {
    $blocks = Blocks::instance($this);
    return [
    'blocks' => $blocks !== null ? $blocks->forPage($this) : null,
    ];
    }
    }
  3. Render the page blocks

    import { BlockRenderer } from '../../blocks/BlockRenderer';
    import type { BlockPageComposition } from '../../blocks/types';
    export default function Show({ blocks }: { blocks?: BlockPageComposition | null }) {
    return <BlockRenderer composition={blocks} />;
    }

    Place your component at site/templates/assets/js/blocks/FeatureBannerBlock.tsx. BlockRenderer auto-discovers ./*Block.tsx files and maps PascalCaseBlock.tsx to snake_case block handles.

  4. Validate your blueprints with blocks:doctor

    Terminal window
    php vendor/bin/wire blocks:doctor --json

Next steps