UI Layouts

Layouts are JSON files that define how an entity’s edit and view pages are structured in the UI. They control which fields appear in which sections, how tabs are organized, and where component blocks (assets panel, relationship graph, timeline, etc.) are placed.

Without a layout file, StudioBrain auto-generates a default form from the template’s field list. With a layout file, you get full control over the page structure.

Where Layouts Live

Layout files are stored in _Templates/Layouts/ and follow the naming convention {entity_type}.layout.json:

_Templates/Layouts/
  character.layout.json
  location.layout.json
  biome.layout.json
  recipe.layout.json

CatalogSync provides default layouts from the studiobrain-templates catalog repo in the templates/Layouts/ directory. These are discovered alongside templates during catalog sync.

Layout Structure

A layout file is a JSON object with sections and optional tabs:

{
  "entity_type": "character",
  "sections": [
    {
      "id": "identity",
      "label": "Identity",
      "tab": "overview",
      "fields": ["name", "display_name", "age", "species", "faction"]
    },
    {
      "id": "appearance",
      "label": "Appearance",
      "tab": "overview",
      "fields": ["physical_description", "distinguishing_features"],
      "component": "primary-image"
    },
    {
      "id": "personality",
      "label": "Personality & Traits",
      "tab": "details",
      "fields": ["traits", "motivations", "fears", "speech_patterns"]
    },
    {
      "id": "backstory",
      "label": "Backstory",
      "tab": "details",
      "fields": ["backstory", "key_events"],
      "component": "markdown-content"
    },
    {
      "id": "relationships",
      "label": "Relationships",
      "tab": "relations",
      "component": "entity-relationships"
    },
    {
      "id": "assets",
      "label": "Assets",
      "tab": "assets",
      "component": "entity-assets"
    }
  ],
  "tabs": [
    { "id": "overview", "label": "Overview" },
    { "id": "details", "label": "Details" },
    { "id": "relations", "label": "Relations" },
    { "id": "assets", "label": "Assets" }
  ]
}

Sections

Each section represents a visual block on the entity page. A section can contain form fields, a component block, or both.

FieldTypeRequiredDescription
idstringYesUnique section identifier
labelstringYesDisplay heading for the section
tabstringNoWhich tab this section belongs to. If omitted, appears on all tabs.
fieldslistNoTemplate field names to render in this section
componentstringNoA component block ID to render in this section
collapsedbooleanNoWhether the section starts collapsed (default: false)

Component Blocks

Component blocks are reusable UI widgets that render specialized content beyond simple form fields. The built-in blocks are:

Block IDDescription
entity-assetsFile and image asset browser for the entity
entity-timelineChronological timeline of entity events
production-statusProduction pipeline status tracker
markdown-contentRich Markdown editor for long-form content
primary-imageFeatured image display and upload
entity-chatAI chat interface scoped to the entity
entity-relationshipsRelationship graph showing connections to other entities
entity-workflow-triggerWorkflow automation trigger panel

Plugin blocks use the format plugin:{pluginId}:{panelId} and are available when the corresponding plugin is installed.

Tabs

The tabs array defines the tab bar at the top of the entity page. Each tab has:

FieldTypeRequiredDescription
idstringYesTab identifier (referenced by sections’ tab field)
labelstringYesDisplay label on the tab bar
iconstringNoLucide icon name to show next to the label

If no tabs array is provided, StudioBrain falls back to six default tabs: Overview, Details, Relations, Assets, Timeline, and AI.

Sections are assigned to tabs via their tab field. A section without a tab value appears on every tab.

Resolution Order

When rendering an entity page, StudioBrain resolves the layout through these layers:

PrioritySourceDescription
1 (highest)Tenant layout (DB)Cloud: per-team customization stored in the database
2Global layout (DB)Cloud: system-wide layout from the database
3Catalog layout_Templates/Layouts/{entity_type}.layout.json from CatalogSync
4 (lowest)Auto-generatedFields rendered in template definition order, default tabs

The first layout found is used. There is no merging between layers — the winning layout defines the entire page structure.

On the self-hosted Core edition, the DB layers (1 and 2) do not apply. The resolution is: catalog layout, then auto-generated.

The Layout Designer

StudioBrain includes a visual Layout Designer accessible from Settings > Templates > Layout Designer. It provides a drag-and-drop interface for building layouts without editing JSON:

  • Add, remove, and reorder sections
  • Assign fields to sections by dragging from the field palette
  • Insert component blocks from the component palette
  • Create and configure tabs
  • Preview the layout in real time
  • Export the layout as a .layout.json file

The Layout Designer saves layouts to _Templates/Layouts/ (or to the database on Cloud).

Creating a Layout Manually

If you prefer editing JSON directly:

  1. Create _Templates/Layouts/{entity_type}.layout.json.
  2. Define your sections and tabs.
  3. Reference field names from the entity’s template.
  4. Save. The layout takes effect immediately for all entities of that type.

Example: Recipe Layout

{
  "entity_type": "recipe",
  "sections": [
    {
      "id": "basics",
      "label": "Recipe Info",
      "tab": "overview",
      "fields": ["name", "cuisine", "dish_type", "prep_time", "cook_time", "servings"]
    },
    {
      "id": "hero_image",
      "label": "Hero Image",
      "tab": "overview",
      "component": "primary-image"
    },
    {
      "id": "ingredients",
      "label": "Ingredients",
      "tab": "recipe",
      "fields": ["ingredients"]
    },
    {
      "id": "steps",
      "label": "Steps",
      "tab": "recipe",
      "fields": ["steps"],
      "component": "markdown-content"
    },
    {
      "id": "notes",
      "label": "Chef's Notes",
      "tab": "recipe",
      "fields": ["notes", "tips", "variations"]
    },
    {
      "id": "media",
      "label": "Photos & Videos",
      "tab": "media",
      "component": "entity-assets"
    }
  ],
  "tabs": [
    { "id": "overview", "label": "Overview" },
    { "id": "recipe", "label": "Recipe" },
    { "id": "media", "label": "Media" }
  ]
}

Layout-Driven View Pages

By default, entity view pages (the read-only detail page) use a hand-coded layout. To opt into layout-driven rendering for view pages as well, add a view_config section to the layout:

{
  "entity_type": "character",
  "view_config": {
    "layout_driven": true
  },
  "sections": [ ... ],
  "tabs": [ ... ]
}

When layout_driven is true, the view page uses the same section and tab structure as the edit page. If the layout cannot be loaded or layout_driven is false, StudioBrain automatically falls back to the legacy hand-coded view page.

Next Steps