Skip to content

Admin UI with Block Kit

Build plugin admin pages and order panels with declarative blocks.

A plugin’s admin UI is declarative JSON. The EdgeCart host renders the blocks; the sandbox never sends JavaScript, CSS, or HTML to the admin.

Declare a page

{
  "capabilities": ["admin:ui"],
  "hooks": ["admin:interaction"],
  "admin": {
    "pages": [
      { "path": "overview", "label": "Loyalty", "icon": "ph:heart" }
    ]
  }
}

The installed plugin card links to the console page. The host loads the page through POST /api/plugins/installs/:id/admin/page and dispatches actions through POST /api/plugins/installs/:id/admin/action.

Interaction model

The admin:interaction hook receives one of:

{ "type": "page_load", "page": "overview" }
{ "type": "block_action", "action": "refresh" }
{ "type": "form_submit", "form": "settings", "values": {} }

The plugin returns the next blocks. The host validates every block before rendering and re-checks installation status, release approval, admin:ui consent, and the declared page on every call.

Blocks

Common block types include:

  • Layout: header, section, divider, columns, tab, accordion, empty.
  • Data: fields, table, stats, chart, code, context, image.
  • Actions: actions, button, link, menu.
  • Forms: form, text_input, number_input, select, toggle, secret_input, checkbox, date_input, combobox, radio.
  • Messaging: banner.

Tables and forms use scalar cells and declared field definitions. A form submission is validated against the form schema before it reaches the plugin.

Limits

  • Admin response: 256 KiB, 20 levels, 2,000 nodes, 1,000 array items.
  • Console page response: 64 KiB.
  • Responsive requests are no-store.

Order panels

admin.orderPanel renders blocks on the order detail page. Use it for order-scoped summaries and actions; the host supplies the order context.

Example response

{
  "ok": true,
  "value": {
    "blocks": [
      { "type": "header", "text": "Loyalty" },
      {
        "type": "stats",
        "items": [
          { "label": "Members", "value": "128" },
          { "label": "Discount", "value": "5%" }
        ]
      },
      {
        "type": "form",
        "formId": "settings",
        "fields": [
          { "name": "percent", "label": "Discount percent", "type": "number" }
        ],
        "submitLabel": "Save"
      }
    ]
  }
}

Type to search…

↑↓ navigate↵ selectEsc close