Skip to main content

Page Blocks

In the Dashboard, all pages are built from blocks. Every block has a pageId and a blockId which uniquely locates it in the app (see Dev Mode section).

You can also define your own blocks, which can be added to any page and can even replace the default blocks.

Info

All available options are documented in the DashboardPageBlockDefinition reference

Basic Page Block Example

Here's an example of how to define a custom page block:

src/plugins/my-plugin/dashboard/index.tsx

This will add a "Related Articles" block to the product detail page:

Related Articles page block

Block Positioning

Page blocks can be positioned in three ways relative to existing blocks:

Before

Places the block before the specified blockId:

Tsx

After

Places the block after the specified blockId:

Tsx

Replace

Replaces the existing block entirely:

Tsx

Block Columns

Blocks can be placed in three columns:

  • main: The main content area (wider column on the left)
  • side: The sidebar area (narrower column on the right)
  • full: Takes up the full horizontal width. This is mostly useful for adding blocks to list pages

Context Data

The context prop provides access to:

  • entity: The current entity being viewed/edited (e.g., Product, Customer, etc.)
  • form: The React Hook Form instance for the current page (if applicable)
  • route: Route information and parameters

Block Visibility

The visibility of a block can be dynamically controlled using the shouldRender function. This function receives the same context object as the block component, and should return a boolean to determine whether the block should be rendered.

Ts
Tip

The shouldRender function can be used to hide built-in blocks by combining it with the "replace" position on an existing blockId.

Advanced Example

Here's a more complex example that shows different types of blocks:

src/plugins/my-plugin/dashboard/index.tsx

Finding Block IDs

To find the pageId and blockId values for positioning your blocks:

  1. Enable Dev Mode in the dashboard
  2. Navigate to the page where you want to add your block
  3. Hover over existing blocks to see their IDs
  4. Use these IDs in your block positioning configuration
Best Practices
  1. Use descriptive IDs: Choose clear, unique IDs for your blocks
  2. Position thoughtfully: Consider the user experience when placing blocks
  3. Handle loading states: Show appropriate loading indicators for async operations
  4. Follow design patterns: Use the dashboard's existing UI components for consistency
  5. Test thoroughly: Verify your blocks work correctly on different screen sizes
Was this chapter helpful?
Report Issue
Edited Feb 23, 2026ยทEdit this page