UI Layouts
Layouts are JSON documents that define how an entity type’s edit and view pages are structured: which fields appear in which sections, how tabs are organized, and where component blocks (assets panel, relationship graph, timeline, etc.) are placed.
Without a saved layout, StudioBrain auto-generates one from the template’s field list, so every entity type (including custom types) gets a working form and detail view. A saved layout gives you control over the page structure.
Where Layouts Live
| Edition | Storage |
|---|---|
| Self-hosted Core / desktop | JSON files at _Templates/Layouts/{entity_type}.layout.json in the content root. |
| Cloud (SaaS) | Rows in the project’s entity_layouts table (ProjectStore Durable Object). Template ingest does not seed a layout; layouts are saved from the Layout Designer. Read with GET /api/layouts and GET /api/layouts/{entity_type}. |
Layout Structure
A layout is a JSON object with entity_type, version, sections, and optional tabs and view_config:
{
"entity_type": "character",
"version": "1.0",
"sections": [
{
"id": "identity",
"title": "Identity",
"columns": 2,
"fields": [
{ "key": "name", "label": "Name" },
{ "key": "species" },
{ "key": "faction" }
]
},
{
"id": "portrait",
"title": "Portrait",
"component": "primary-image"
},
{
"id": "assets",
"title": "Assets",
"component": "entity-assets"
}
]
}Sections
Each section is a visual block on the page. A section can contain fields, a component block, or both.
| Field | Type | Description |
|---|---|---|
id | string | Unique section identifier |
title | string or null | Display heading |
icon | string | Optional icon name |
description | string | Optional helper text |
columns | number | Number of field columns |
collapsed_default | boolean | Whether the section starts collapsed |
fields | list | Field objects; key is the template field name. Optional label, ui_component, column_span, rows, required, read_only, placeholder, help, options, group, and others |
component | string | A component block ID to render in this section |
component_config | object | Config passed to the component block |
Template fields that a saved layout does not place are appended in an “Other fields” section, so a field added to a template later is not silently hidden.
Component Blocks
| Block ID | Description | Modes |
|---|---|---|
entity-assets | Asset browser for the entity | edit, view |
entity-timeline | Timeline of entity events | edit, view |
production-status | Production pipeline status | edit, view |
markdown-content | Renders the entity’s Markdown body | view |
primary-image | Primary image display | edit, view |
entity-chat | AI chat scoped to the entity | view |
entity-relationships | Relationships to other entities | view |
entity-workflow-trigger | Workflow trigger panel | edit |
ai-generation-hub | AI generation hub | edit, view |
static-content | Static content block | edit, view |
Plugin blocks use the ID plugin:{pluginId}:{panelId} and are available when the plugin is installed. See Component Blocks for the full reference.
A layout can also set editor_component or viewer_component to a registered block ID to use that block as the entire edit or view page for the type.
Tabs
The edit page tab bar comes from the layout’s tabs array, or from six built-in tabs when none is defined: Visual Editor, YAML Frontmatter, Markdown Content, Preview, Assets, and AI Generation. Plugin panels can add tabs.
| Field | Description |
|---|---|
id | Tab identifier. A built-in id (visual, yaml, markdown, preview, assets, generation) uses the built-in body |
label | Display label (title is accepted as an alias) |
icon | Optional icon name |
source | builtin, plugin, or template |
content | For custom tabs: { "type": "section_group", "section_ids": [...] }, { "type": "component_block", "block_id": "..." }, or { "type": "plugin_panel", "plugin_panel_id": "plugin:..." } |
Sections are not assigned to a tab by a section-level field; a custom tab selects its sections through content.section_ids.
Resolution
The page uses the saved layout for the entity type if one exists (tenant or project scope first, then the shared/global one). If none exists, or the saved one is an auto-generated seed, the layout is auto-generated from the template schema. There is no merging between a saved layout and the auto-generated one, apart from the “Other fields” section described above.
The Layout Designer
The Layout Designer is a drag-and-drop editor for layouts. Open it from Settings > Entity Types, select a type, and choose the Layout tab. It lets you add, remove, and reorder sections, assign fields, insert component blocks, configure tabs, and preview the result.
Layouts can also be edited as JSON. On Core, create _Templates/Layouts/{entity_type}.layout.json and reference field names from the entity’s template.
Layout-Driven View Pages
View (read-only detail) pages follow the layout only when it opts in:
{
"entity_type": "character",
"view_config": {
"layout_driven": true
},
"sections": [ ... ]
}view_config also accepts view_only_sections (extra view-only blocks) and tabs (a tab shell for view mode, using the same tab shape as above).
When layout_driven is not true, the view page uses the type’s bespoke page if one exists; otherwise it renders the template’s auto-generated layout, so custom types always get a browse and detail view.
Next Steps
- Template System Overview — What templates are and how they work
- Template Packs — Bundled templates, rules, and layouts
- Inheritance & Overrides — How resolution layers work