Skip to main content

Collections and factories

Collections and factories are the mechanism by which JSON UI draws lists whose size is not fixed. They handle data that is known only when the screen is used, such as the number of server form buttons, the number of chest slots and the number of chat lines.

  • Collection: the list of items the engine provides. There are form buttons (form_buttons), modal form rows (custom_form), chest slots (container_items) and chat lines (chat_text_grid), and each item comes with value bindings such as #form_button_text or #item_id_aux. Inside a container that has collection_name, collection_index decides which item to read, and a binding points to which collection to read with binding_collection_name.
  • Factory: a mechanism that creates controls at runtime as many as there are items. In the container's factory property (or a "type": "factory" control) you write what to create (control_name, control_ids), and how many to create is decided by the engine or by the #collection_length binding.
  • Grid: a container that places the same template control in a lattice. Fix the cell count with grid_dimensions or set the count with #maximum_grid_items.

The smallest examples​

Example 1. Fixed-index slots (reading only a collection without a factory, COL-06). If the server always sends the same number of buttons, you can hardcode in JSON which item each cell reads.

"tab_slots": { "type": "stack_panel", "orientation": "horizontal",
"collection_name": "form_buttons",
"controls": [
{ "slot0@my.tab_cell": { "collection_index": 0 } },
{ "slot1@my.tab_cell": { "collection_index": 1 } }
] }

Example 2. A factory whose count is set by a binding (the first example of the Bedrock Wiki original below). If you take the number out of the title string Count:3 and put it into #collection_length, 3 controls are created. If it is 0, nothing is created (COL-11).

Example 3. Placing the engine factory again (COL-14). If you place one more factory of the same name, a second UI is created from the same data.

"server_form_factory": { "type": "factory",
"control_ids": { "long_form": "@my.long_form", "custom_form": "@my.custom_form" } }

The Bedrock Wiki explanation (Dynamic Content Generation)​

The Bedrock Wiki (bedrock-wiki 0930b39) explains factories and grids this way. The original (CC BY 4.0) is reproduced as is. It is the basic usage of #collection_length, the control_ids array, #maximum_grid_items and grid_position that this document uses. The wiki examples use the HUD title string (#hud_title_text_string) as material.

Excerpt: Dynamic Content Generation - Factories · docs/json-ui/dynamic-content-generation.md · Bedrock Wiki · License CC BY 4.0 (docs/licenses/CC-BY-4.0.md in the repository) · Commit 0930b39

Factories

A factory generates UI elements specified in its control_name or control_ids properties.

  • Invocation: Many of the vanilla factories are invoked natively by the engine. Alternatively, factories can be invoked manually by overriding the #collection_length property.
  • Data Binding: For the use of #collection_length, the factory must reside within a collection-supporting container (e.g., collection_panel or stack_panel). The value can either be an int or a string[] based on the implementation of the factory.

Key properties

PropertyTypeShort Description
namestringThe unique identifier for the factory. This is critical for factories natively invoked by the engine, though custom factories can use any arbitrary string.
control_namestringReference to the control to be generated by the factory
control_idsObjectAn object mapping arbitrary string keys to the references of the controls to be generated. Used when generating multiple distinct controls. Must remain unchanged for natively invoked factories.
factory_variablesstring[]List of variables that should be passed to the controls generated by the factory
max_children_sizeintMaximum number of controls to be generated

Usage

Using control_name:

In this case, #collection_length must be overridden with an int value. This is the number of elements that will be generated.

{
"hud_apple": {
"type": "image",
"texture": "textures/items/apple",
"size": [32, 32]
},

"apple_factory": {
"type": "stack_panel",
"size": [ "100%cm", "100%c" ],
"factory": { // Defined in a stack_panel (Supports collection)
"name": "hud_apple_factory",
"control_name": "hud.hud_apple" // Reference to hud_apple
},
"bindings": [
{
"binding_name": "#hud_title_text_string",
"binding_name_override": "#count"
},
{
"binding_type": "view",
"source_property_name": "(#count - 'Count:' + 0)", // Gets the int value
"target_property_name": "#collection_length" // Overriding #collection_length
}
]
}
}

Here, an integer value is sent through the title as Count:{value} that indicates the number of elements to generate. The bindings listed above first fetch the title string and store it in #count. Then, #count - 'Count:' gets the int value and #collection_length is overridden with this value. Note: + 0 sets a default value of 0 if the string is empty.

Expected result: For title: Count:3

Using control_ids:

In this case, #collection_length must be overridden with an array of strings. The strings are the keys defined in control_ids. There's not much freedom with this approach as there is no way to manipulate arrays in JSON UI. Instead, we can pre-define some arrays within the property_bag and choose from them. The elements will be generated in the order specified in the array.

{
"hud_apple": {
"type": "image",
"texture": "textures/items/apple",
"size": [32, 32]
},

"hud_label": {
"type": "label",
"text": "Apple!",
"shadow": true
},

"apple_factory": {
"type": "stack_panel",
"size": [ "100%cm", "100%c" ],
"factory": {
"name": "hud_apple_factory",
"control_ids": {
"apple": "hud.hud_apple", // An arbitrary name mapped to the reference of a control
"label": "hud.hud_label"
}
},
"property_bag": {
// Some pre-defined arrays
"#list1": [ "apple", "label" ],
"#list2": [ "label", "apple" ]
},
"bindings": [
{
"binding_name": "#hud_title_text_string",
"binding_name_override": "#choice"
},
{
"binding_type": "view",
"source_property_name": "('#list' + #choice)", // Constructing key name
"target_property_name": "#collection_length"
}
]
}
}

Here, we have defined two controls in control_ids and two arrangements of these controls as #list1 and #list2. In the bindings, we fetch the title string and store it in #choice, which is an integer representing the list to be selected. Then using ('#list' + #choice), we construct the name of the list and that list is then overridden to #collection_length.

Expected result: For title: 1 and 2 respectively

 

Excerpt: Dynamic Content Generation - Factory (Extra) · docs/json-ui/dynamic-content-generation.md · Bedrock Wiki · License CC BY 4.0 (docs/licenses/CC-BY-4.0.md in the repository) · Commit 0930b39

Factory (Extra):

You can define factories directly using "type": "factory" as well. These factories are always invoked natively by the engine. However, it is possible to define these factories in the ways discussed above we can also modify the control references to generate custom elements instead.

{
"main_screen_content": { // Vanilla code from server_form.json
"type": "panel",
"size": [0, 0],
"controls": [
{
"server_form_factory": { // Name of control here acts as the factory name and thus should remain unchanged
"type": "factory",
"control_ids": {
"long_form": "@server_form.long_form",
"custom_form": "@server_form.custom_form"
}
}
}
]
}
}
Excerpt: Dynamic Content Generation - Grids · docs/json-ui/dynamic-content-generation.md · Bedrock Wiki · License CC BY 4.0 (docs/licenses/CC-BY-4.0.md in the repository) · Commit 0930b39

Grids

Grids generate and arrange UI elements in a grid layout. The elements are generated from a template control specified in its grid_item_template property. We can either generate a fixed number of elements by defining grid_dimensions or a variable number by overriding its #maximum_grid_items binding or maximum_grid_items property.

Key properties

danger

Try not to use vertical as the value of grid_rescaling_type. It may crash your game.

Usage

info

Grids typically have a default size of ["100%c", "100%c"]. It is ideal to keep the height dynamic (100%c). If a fixed height is applied, generated elements may overlap if the height is too small, or have unintended gaps if the height is too large.

Using grid_dimensions:

It is recommended not to override the size property in this case, as some elements can go outside the grid bounds and mess up the layout.

{
"hud_apple": {
"type": "image",
"texture": "textures/items/apple",
"size": [32, 32]
},

"apple_grid": {
"type": "grid",
"grid_dimensions": [3, 3],
"grid_item_template": "hud.hud_apple"
}
}

Expected result:

Overriding #maximum_grid_items:

For this to work properly, you have to modify the width of the grid. This is because the number of columns in this case will be floor( width of grid / width of template control ). Moreover, we need to set grid_rescaling_type to horizontal. Then we have to override #maximum_grid_items through bindings, or alternatively, define the maximum_grid_items property.

{
"hud_apple": {
"type": "image",
"texture": "textures/items/apple",
"size": [32, 32]
},

"apple_grid": {
"type": "grid",
"size": [160, "100%c"], // floor(160 / 32) = 5; Meaning the grid will have 5 columns
"grid_item_template": "hud.hud_apple",
"grid_rescaling_type": "horizontal",
"bindings": [
{
"binding_name": "#hud_title_text_string",
"binding_name_override": "#count"
},
{
"binding_type": "view",
"source_property_name": "(#count - 'Count:' + 0)", // Gets the int value
"target_property_name": "#maximum_grid_items" // Overriding #maximum_grid_items
}
]
}
}

Here, an integer value is sent through the title as Count:{value} that indicates the number of elements to generate. The bindings listed above first fetch the title string and store it in #count. Then, #count - 'Count:' gets the int value and #maximum_grid_items is overridden with this value.

Expected result: For title: Count:15

Grid Position

There might be situations where you'd want to manually add controls to the grid instead of generating them from a template. With the grid_position property you can place your control anywhere on the grid.

Usage

Let's say we have a grid with 2 columns and 2 rows and we want to place our controls in this way-

The format [row, column] indicates the placement within the grid, where the first integer is the row index and the second integer is the column index. The following integer is the index it takes inside the grid for a defined collection.

The code:

{
"hud_apple": {
"type": "image",
"texture": "textures/items/apple",
"size": [32, 32]
},

"apple_grid": {
"type": "grid",
"size": ["100%c", "100%c"], // Define it explicitly to avoid layout issues
"grid_dimensions": [2, 2],
"controls": [
{
"apple_1@hud.hud_apple": {
"grid_position": [0, 0]
}
},
{
"apple_2@hud.hud_apple": {
"grid_position": [1, 1]
}
}
]
}
}

Expected result:

Useful Information

  • When used with a collection, Factories and Grids automatically index generated elements.
  • Generated elements can access outside bindings via source_control_name, but outside elements cannot access bindings from generated elements.
  • Invisible elements inside a Grid still occupy physical space, which can leave unintentional gaps in your UI.
  • In Grids, animations linked with the next property can appear bugged. After the first animation, the duration divides among the grid elements, causing subsequent animations to speed up. (flip_book animations are the only exception).

The differences between this original and this project's measurements are as follows.

  • The wiki uses (#count - 'Count:' + 0). The reason the result becomes a number is EXP-26 (the type of an intermediate result of an expression is decided again by its appearance). To be sure, write ((#count - 'Count:') - 0).
  • The wiki builds a factory with only stack_panel + factory without collection_name. The same approach worked in measurement (COL-24).
  • The wiki says controls inside a factory or grid read outside bindings with source_control_name but the outside cannot read the inside (the same conclusion as BND-19).
  • The wiki's "bug where animations chained with next inside a grid speed up" and the warning that grid_rescaling_type: vertical can freeze the game were moved to ANI-18 (unverified).
  • Grid property summary: grid_dimensions ([column, row]), grid_dimension_binding (the binding name for the cell count, hardcoded names only), grid_item_template (a reference to the cell definition), grid_rescaling_type (none, horizontal, vertical), maximum_grid_items (maximum count, binding #maximum_grid_items), grid_position ([row, column]). The column count is floor(grid width / template width).

The way to read the list data the engine provides (form buttons, modal rows, chest slots, chat lines, dialogue buttons) is a collection, and the mechanism that creates controls as many as the items of that list is a factory. The full factory summary is in Factory synthesis.

Evidence from Cinnabar (CN, Rust code that reconstructs the JSON UI parser of the 26.30 native client) has the level code, and CN-run is the result of this project running that evaluator directly. If it differs from game measurement, follow measurement. NB was read by analyzing the native library of the Android 1.26.52.3 client, and its level is code. DF was measured on Windows 1.26.52 while building the research server, in a structure that draws several screens with one server form. FFR was measured on mobile with the server form factory and lag test add-on (2026-11-14). The add-on setup is in Server form research screen.

Collection addressing​

  • [COL-01] collection_name is used on stack_panel, grid and collection_panel. Using it on panel or image gives an Unknown property [collection_name] error. {measured, vanilla} (Source: BC-facts, BC-S9, BC-S11, VN grid 66, stack_panel 25, collection_panel store_common.json:750, MJ chapter 9)
  • [COL-02] collection_index is received only at the instantiation point (an item inside the parent's controls). Written in a top-level definition it is rejected, and on an image it is rejected anywhere. On a label it is read: on Windows 1.26.65.1, a label with collection_index directly under a collection_name stack_panel read its value (b1) (measurement record). The engine reads collection_index only on direct children of a parent that has a collection name (COL-44). {measured, code (binary)} (Source: BC-facts, NB-07, BC 4.1-(4))
  • [COL-03] The index is inherited down the subtree from the point where it was applied. So the pattern of writing the definition once and giving N references only a different index and offset holds. Bindings that read a collection each specify the collection with binding_collection_name. {measured} (Source: BC-facts)
  • [COL-04] A server form button counts a press toward that entry only if the button itself has { "binding_type": "collection_details", "binding_collection_name": "form_buttons" }. If only an ancestor gives the index, it can be pressed but the script receives canceled, which cannot be told from Esc, and there is no log (when the user closes it, reason=UserClosed arrives, but whether the reason for a missing binding can be told apart was not confirmed). Vanilla form buttons have the same structure. {measured, vanilla} (Source: BC-S1, BC-facts, VN server_form.json:211-225)
  • [COL-05] A collection binding with no index host at all reads item 0. This property was used to hide the vanilla chest label with the slot 0 item. {measured} (Source: BC-facts)
  • [COL-06] You can make fixed-index slots without a factory: put children with hardcoded collection_index in a stack that has collection_name. The script always sends the same number of entries (including empty values) to fix the index. {working pack, code (source)} (Source: BA chapter 5 tab 28 slots, BC 4.1-(3))
"tab_slots": { "type": "stack_panel", "orientation": "horizontal",
"collection_name": "form_buttons",
"controls": [
{ "slot0@my.tab_cell": { "collection_index": 1 } },
{ "slot1@my.tab_cell": { "collection_index": 2 } } ] }
  • [COL-26] Factories and grids used with collections automatically attach an index to the controls they create. {unverified} (Source: BW-dyn)
  • [COL-38] collection_index took effect only on a direct child of a stack_panel that has collection_name. When that place was a panel, Unknown property [collection_index] and [collection_name] were printed in the content log and it was empty (the same conclusion as COL-01 and COL-02, and the same for the chest screen container_items). {measured} (Source: DF)
  • [COL-44] When creating a control, if the parent has a collection component with a collection name, that control automatically becomes a collection item. collection_index is read only then (default -1) and fixes the index. So collection_index is meaningful only on a direct child of a collection parent (the same conclusion as COL-02 and COL-38). For a control that is a direct child but must not become an item (a decorative panel, etc.), give "ignoreCollectionItem": true. {code (binary)} (Source: NB-07)
  • [COL-50] For a 2D layout of fixed collection_index cells, put horizontal stack_panel rows that have collection_name inside a vertical stack_panel, and put the cells as direct children of the rows (COL-38, LAY-56). If the cell parent was a panel, every cell drew the same button (index 0) even with different indices per cell, and adding a collection_details binding or toggle_grid_collection_name to the cells did not change it. {measured} (Source: FFR)

Reading values from a collection​

CollectionItem value bindings (examples)Source
form_buttons (action form)#form_button_text, #form_button_texture, #form_button_texture_file_systemVN server_form.json, BC, BA
custom_form (modal form)#custom_toggle_state, #custom_slider_steps, #custom_slider_value, #custom_dropdown_length …VN, BC 4.2
custom_dropdown, custom_multiselect#custom_radio_toggled, #custom_radio_text, #dropdown_option_text, #custom_multiselect_toggledVN server_form.json:485 and 582, MJ 4.1
container_items (chest)#item_id_aux, #inventory_stack_count, #item_durability_current_amount, #item_durability_total_amount, #item_custom_colorBC-facts, BC-S14
student_buttons_collection (NPC dialogue)#student_button_text (+ binding_collection_prefix: "student_buttons")VN npc_interact_screen.json:1180, AP 4.3
chat_text_grid (chat)#chat_textAP-samples hud_screen.json
  • [COL-07] The durability of chest slots (#item_durability_current_amount, #item_durability_total_amount) can be read in ordinary controls and compared and divided if read with a collection_details + collection binding pair. #item_durability_current_amount is the remaining durability (((0 + value) > 100) was true for an iron sword with 100 damage). The value is a float, so comparisons work but concatenating it to a string gives nothing (EXP-22). ('D ' + (0 + value)) and ('D ' + (value * 1)) gave only 'D ' whatever the binding setup. To show it as text, split it into ranges with a comparison chain. {measured, inferred} (Source: BC-S14, BC-S6, BC 6.8-7, CPR)
  • [COL-30] The engine writes the grid cell count as #grid_number_size, the factory creation count as #collection_number_size and the collection size as #collection_total_items into the bag. A view binding can read them for use such as an "empty" indicator. {code (source)} (Source: CN tests B55 and B41)

Factories​

A factory has two forms.

// (a) A factory control: type is factory. The entry point of vanilla server_form
"server_form_factory": { "type": "factory",
"control_ids": { "long_form": "@server_form.long_form", "custom_form": "@server_form.custom_form" } },

// (b) The factory property of a container: a stack/panel/collection_panel creates the cells
"long_form_dynamic_buttons_panel": { "type": "stack_panel",
"factory": { "name": "buttons",
"control_ids": { "button": "server_form.dynamic_button", "label": "@server_form.dynamic_label",
"header": "@server_form.dynamic_header", "divider": "@settings_common.option_group_section_divider" } },
"collection_name": "form_buttons",
"bindings": [ { "binding_name": "#form_button_contents", "binding_name_override": "#collection_length" } ] }
  • [COL-08] A factory is either (a) a "type": "factory" control (36 uses in vanilla, not in the official enum) or (b) the "factory": { … } property of a container. The keys of the factory object are name, control_name (one kind) or control_ids (per kind), max_children_size and factory_variables. {vanilla} (Source: VN server_form.json:25 and 126, VN factory key tally)
  • [COL-09] The keys of control_ids are data kinds the engine decides, and the values are "@ns.definition" (197 uses in vanilla), "instancename@ns.definition" (36 uses) and "ns.definition" (5 uses, for example server_form.json:128). The action form rows are button, label, header and divider, the modal rows are label, toggle, slider, step_slider, dropdown, input, header, divider and multiselect, the HUD ones are hud_title_text and hud_actionbar_text, and chat's is chat_item. {vanilla} (Source: VN server_form.json:126 and 283, hud_screen.json:3406, 3417 and 1040)
  • [COL-10] visible only stops drawing and does not stop creation and layout. A screen attached under the server form is fully created and laid out every time any form is opened, even if hidden with visible (measured with 5,546 controls repositioned). A component inside it that validates its state at creation, such as a slider, raises an assert even when hidden. The control's own binding_condition: "visible" also does not stop evaluation when an ancestor is hidden. {measured} (Source: BC-S8, BW-best)
  • [COL-11] If you bind #collection_length, the factory creates only that many cells. If 0, nothing is created. A computed length like ((#mode = 'on') * 1) becomes a gate that "creates only the one screen needed". {measured, vanilla} (Source: BC-S11, VN server_form.json:138 and 300)
  • [COL-12] A comparison of ways to stop creation. {measured, vanilla} (Source: BC-S8, BC-S11, VN)
MethodWhen evaluatedCondition materialCost
ignoredOnce at control creation$variable onlyNot created
Factory #collection_lengthRuntime, binding#binding expressionNot created if 0
visibleEvery frame#binding expressionCreation and layout cost stay
  • [COL-13] A row type factory creates a cell for every matching row. If there are three slider rows, three slider cells are created per socket. Cells that are not their own row are pushed off screen with #anchored_offset_value_y (((not #mine) * 1000)). {measured} (Source: BC-S9)
  • [COL-14] If you declare an engine factory of the same name once more at another location, a second UI is created from the same data. All three packs use this method: server_form_factory (BC, BA), hud_title_text_factory (BA, AP) and chat_item_factory (AP). {working pack, code (source)} (Source: BC 4.1-(1), BA chapters 2 and 6, AP 4.1 and 4.5, BW-form, BW-intro)
  • [COL-15] factory_variables: ["$a", "$b"] passes the factory host's variables to the created controls. The engine looks up each name in the scope that declared the factory and passes its value (COL-41). Vanilla uses it 37 times (store, pdp, marketplace_sdl, realms_settings, toast_screen, etc.), but none of this project's sources measured it in game. {vanilla, code (binary)} (Source: VN store_common.json and others 37 uses, NB-04)
  • [COL-16] max_children_size is the maximum number a factory creates (vanilla HUD chat 50, AP toast 12). A second factory sharing the same data uses up the limit even on invisible items. {vanilla, working pack, inferred} (Source: VN hud_screen.json:1041, AP 4.5)
  • [COL-17] Controls created by an engine factory sometimes receive data as variables. The vanilla actionbar label uses "text": "$actionbar_text", and AP reads $title_text in a control created by hud_title_text_factory and decides with ignored. A variable is decided once at creation, so when the value changes the factory recreates the control. {vanilla, working pack} (Source: VN hud_screen.json:2158, AP 4.1, BW-intro)
  • [COL-18] If the cells a factory creates are big, opening the screen is slow. BA had hundreds of controls in one node, so opening took several seconds when all tabs were sent, and it was changed to send only the selected tab's node. Reducing cell size x count comes first. {working pack} (Source: BA chapter 4)
  • [COL-22] If you give a factory with control_ids a string array (the list of keys of that control_ids) through #collection_length, it creates controls of those kinds in array order. An expression cannot build an array, so put the array in property_bag in advance ("#list1": ["apple", "label"]) and pick it by assembling the name with ('#list' + #choice). A control_name factory takes an integer. With #collection_length only in property_bag and no binding, nothing was created, array or integer, and binding a global that does not exist to #collection_length gave the same (measurement record). {measured} (Source: BW-dyn, 2 screenshots, 2026-11-19 Windows 1.26.65.1)
  • [COL-23] A '#name' string made by an expression is read as the value of that name in the same control's property_bag (dictionary lookup). COL-22 and bedrock-core's screen routing (HOST-06 ('#route_' + #title_text)) are the same mechanism. Principle: if the result of a parenthesized group is a #name string, it is replaced by the value in that control's bag (EXP-35). {measured, code (source)} (Source: BW-dyn screenshot, BC 4.1-(2), CN-run)
  • [COL-24] A factory driven directly by #collection_length goes in the factory property of a container that supports collections (stack_panel, collection_panel). The wiki example worked with only stack_panel + factory without collection_name. {measured} (Source: BW-dyn screenshot)
  • [COL-25] For a "type": "factory" control, the control name is the factory name (server_form_factory). Make a second factory with "type": "panel" + "factory": { "name": "server_form_factory", … } and name the control so it does not collide with the original or siblings. The engine does not read a factory name separately from a type: factory control, and other types read name of the factory object (COL-42). {code (binary), vanilla} (Source: NB-05, VN server_form.json, BW-form (beware of name collision))
  • [COL-42] If it is "type": "factory" and that control directly has control_name or control_ids, the factory name is not read separately (the control name is the factory name, COL-25). Other types create a factory only when a "factory": { … } object exists, and if its name is empty it leaves The factory name should not be empty!. {code (binary)} (Source: NB-05)
  • [COL-45] Factory resolution path: if it is "type": "factory" and directly has control_name or control_ids, it resolves without a name, and otherwise, regardless of type, it resolves only when factory is an object and reads name (you may also write a factory object on a type: factory). Only one factory attaches to one control. control_name builds the prototype right away with the declaring control's variable scope at resolution, and control_ids stores only the kind and definition string (the COL-29 difference). max_children_size is 0 if omitted. {code (binary)} (Source: NB-13)
  • [COL-27] #collection_length accepts an integer, a boolean (1/0) and an array of role names. A literal numeric length creates that many only in a control_name template factory. A role name not in the factory creates nothing. The engine also gives a role name array (["tag", …]) as a length value on the store screen (COL-46). {code (source), code (binary)} (Source: NB-14 (role name array), CN tests N12 and B41 (the rest))
  • [COL-28] If control_name exists, control_ids is not read. Do not put both together. max_children_size: 0 is unlimited. {code (source), code (binary)} (Source: NB-06 (control_name first), CN (max_children_size: 0))
  • [COL-43] A factory reads control_name first and reads control_ids only when it is empty (COL-28). insert_location inserts at the front only when the value is exactly "front" and anything else is back (default back). {code (binary)} (Source: NB-06)
  • [COL-29] Cells of a control_name template and of grid_item_template see the $variables of where the factory was declared. Controls made by control_ids see only their own variables and those passed with factory_variables. The engine builds the control_name prototype in the declaring scope when resolving the factory (COL-45). {code (source), code (binary)} (Source: NB-13 (control_name prototype), CN, COL-15 reinforcement)
  • [COL-41] factory_variables is read only when it is an array and silently ignored if not. If an item is not a string, it leaves the error factory_variables should all be strings of json variables created higher up the tree.. Each name is looked up in the scope of the control that declared the factory, and its value is stored in the factory and received by the created controls (the same as the inference in COL-15). {code (binary)} (Source: NB-04)
  • [COL-36] Factory and grid lengths followed the value even when computed with an expression of #form_button_length. On Windows 1.26.65.1, a stack_panel with collection_name: "form_buttons" and a factory (control_name) was placed inside a factory-created router window, and 6 buttons were sent. With always on the length binding, #form_button_contents made 6, #form_button_length made 6, (#form_button_length - 1) made 5, and ((#form_button_length * 0) + 1) made 1. With binding_condition: "visible" on the length binding, every factory made 0, even the vanilla form #form_button_contents. In a grid with grid_rescaling_type: "horizontal", #maximum_grid_items from #form_button_length (always_when_visible) gave 6 cells and from (#form_button_length - 1) gave 5 cells (measurement log). The DF measurement (Windows 1.26.52), taken in another structure, recorded that an expression (* 1, * (marker match)) made the factory create no buttons and the grid become the expression itself; this structure did not reproduce it. When a factory comes out empty, check the length binding's condition first. {measured} (Source: DF, 2026-11-18 Windows 1.26.65.1)
  • [COL-39] Dictionary lookup routing (HOST-06) worked: with "property_bag": { "#df_layout_1": [ "on" ], "#df_layout_0": [] } on a stack_panel, "factory": { "control_ids": { "on": "…" } }, and #collection_length bound from (('#df_layout_' + (condition * 1))), the layout was created only when the condition matched. There was no freeze or exit (a different result from DBG-19). ('#if_' + boolean) also became '#if_true' or '#if_false' and found the property_bag key (measurement record). {measured} (Source: DF, 2026-11-19 Windows 1.26.65.1)
  • [COL-46] tags_factory_first_hidden_child_index, languages_factory_first_hidden_child_index and <prefix>_first_hidden_child_index, which vanilla does not have, are exclusive to the store detail screen description component. This integer in the property bag decides from which tag or language to hide or push to the next row, and an array repeating "tag" or "language" that many times is given as the length binding value. It is not a general factory feature, so it is not used in server form or HUD factories. Who uses this value was not checked. {code (binary)} (Source: NB-14)
  • [COL-37] With a stack that walks whole buttons per row (a 48-cell grid + a material row), the screen took 4~5 seconds to open, and switching to a fixed layout that reads only one button per cell with collection_index (COL-06) made it about 1 second. Also put only one button per cell (having both a pressable one and a non-pressable one doubles the controls). {measured} (Source: DF)
  • [COL-49] When drawing buttons in a 2-column grid (cell height 30px), it was fine up to 2000 (about 30000px), and at 3000 (about 45000px) and above only the scroll range was long and the cells were drawn overlapping within the top 200px or so. The cause was not confirmed. Drawing the same count as a one-column vertical stack factory of length #form_button_contents drew but lagged heavily. {measured} (Source: FFR)

Form rows and response numbers​

  • [COL-19] The action form collection (form_buttons) in 1.26.50 vanilla receives not only button but also label, header and divider rows. The selection of the response counts only buttons, so mixing in label() shifts the collection index and the selection number. When using it as a data channel, send every entry with button() and make cells that must not be pressable by removing the button mapping. {vanilla, code (source)} (Source: VN server_form.json:126-134, BC 4.1-(3))
  • [COL-20] The custom_form rows of a modal form and formValues line up 1:1. A label() is also a row and null arrives in its place in the response. {measured} (Source: BC-S3)
  • [COL-21] A multiselect row was added to the custom_form factory in 1.26.50 vanilla, but the public Script API (@minecraft/server-ui 2.2.0~2.5.0-beta, both ModalFormData and CustomForm) has no method that sends this row. A server that sends the form JSON directly can use it (HOST-46). {vanilla, code (source), measured} (Source: VN server_form.json:294, MJ 4.1, MS)
  • [COL-34] The client held the action form's #form_button_length at the button count of the largest form seen so far (debug label 93, still 93 after reconnecting, unchanged with always_when_visible too). If you set the grid size from this value, empty cells continue in a smaller form. Send the cell count separately through a data channel such as the body (EXP-45). It did not reproduce on Windows 1.26.65.1 (2026-11-19): a 4-button form opened after a 30-button form gave 4 (measurement record). {measured, conflict} (Source: DF, 2026-11-19 Windows 1.26.65.1)
  • [COL-35] A wrapping grid gives cells to hidden buttons too. Send marker buttons such as tab, back and page after the cell buttons (if placed before, the cells start shifted), and put only the number of cell buttons in the grid size (putting more made one extra empty row and the window scrolled a few pixels). {measured} (Source: DF)

Form data inside windows created by a factory​

  • [COL-40] Fixed collection_index cells inside a layout created by our factory also receive action form data, but they need a binding condition. On Windows 1.26.65.1, the fixed cells in the window of a router inserted with insert_back into main_screen_content of server_form were empty on first open with the default condition and filled from the first open with always on both bindings (measurement record, COL-47). panel + factory created nothing. In one setup (DF) only grid (grid + collection_name) cells received data, and fixed cells and an inner #form_button_contents factory stayed empty even with always; the router position in that setup was not checked. With a 1x1 grid lazy root in the same router window (grid [1,1], #maximum_grid_items set to the button count with once and to a title check expression with visible) and fixed collection_index 0, 4, 5 on a stack_panel inside its cell, the cells filled from the first open even with the default binding condition (same on a second open, record). {measured} (Source: DF, 2026-11-19 Windows 1.26.65.1)
  • [COL-47] Inside a window created by the dictionary lookup router (HOST-06) placed in $screen_content of third_party_server_screen, the fixed collection_index cells, the radio toggle cells and a stack factory of length #form_button_contents all received action form data. But if the cells' collection, collection_details and body bindings had the default condition, they were empty on first open and filled after switching a tab once, and when all were set to binding_condition: "always" they were filled as soon as it opened. On Windows 1.26.65.1, fixed cells measured with a router inserted with insert_back into main_screen_content of server_form behaved the same: empty on first open with the default condition (both when opened from the HUD and when coming from a menu form), and filled from the first open with always on both bindings (measurement record). When the fixed cells sit inside the cell of a 1x1 grid lazy root (grid [1,1], #maximum_grid_items set to the button count with once and to a title check expression with visible) instead of directly in the router collection_panel, they filled from the first open even with the default condition (2026-11-19 Windows 1.26.65.1, record). {measured} (Source: FFR)
  • [COL-48] A factory placed inside a cell created by a factory created nothing at first if #title_text and the length binding had the default condition. Giving those two bindings always made it created as soon as it opened. Changing the inside to a grid also worked. Having a size animation recalculate the layout, or reading the length from an outside data source, had no effect. {measured} (Source: FFR)

Example: the smallest collection grid​

A minimal setup that draws the action form buttons the server sent in a 2-column grid. This example worked in game with the code below as is {measured} (example measurement record, 2026-11-27 Windows 1.26.65). It is jup.json and server_form.json of Grid button list trimmed down.

Rules it relies on: COL-01, COL-02, COL-10, COL-47. The order and conditions follow Filling the first frame without always (BND-37).

The complete add-ons measured in game can be downloaded from two documents. Grid button list is a list with a scroll area, icons and progress bars, and Filling the first frame without always is a comparison add-on with two lists whose binding conditions differ.

RP/
manifest.json
ui/
_ui_defs.json
mygrid.json
server_form.json

manifest.json needs only a single resources module, the same as in the example in section 10 of HUD and title channels. _ui_defs.json registers only the new file. server_form.json is at the same path as vanilla, so it is not registered (FILE-01).

{
"ui_defs": [
"ui/mygrid.json"
]
}

ui/mygrid.json defines the cell, the grid, the window and the router.

{
"namespace": "mygrid",
"cell_face": {
"type": "panel",
"size": [ "100%", "100%" ],
"$bg_texture|default": "textures/ui/button_borderless_light",
"controls": [
{ "bg": { "type": "image", "texture": "$bg_texture", "size": [ "100% - 2px", "100% - 2px" ] } },
{
"name": {
"type": "label",
"layer": 3,
"size": [ 90, 10 ],
"offset": [ 6, 10 ],
"anchor_from": "top_left",
"anchor_to": "top_left",
"color": [ 0.1, 0.1, 0.1 ],
"localize": false,
"text": "#text",
"bindings": [
{ "binding_type": "collection", "binding_collection_name": "form_buttons", "binding_name": "#form_button_text" },
{ "binding_type": "view", "source_property_name": "('%.12s' * #form_button_text)", "target_property_name": "#text" }
]
}
}
]
},
"cell@common.button": {
"size": [ 100, 30 ],
"$focus_enabled": false,
"$pressed_button_name": "button.form_button_click",
"bindings": [
{ "binding_type": "collection_details", "binding_collection_name": "form_buttons", "binding_condition": "always" }
],
"controls": [
{ "default@mygrid.cell_face": {} },
{ "hover@mygrid.cell_face": { "$bg_texture": "textures/ui/button_borderless_lighthover" } },
{ "pressed@mygrid.cell_face": { "$bg_texture": "textures/ui/button_borderless_lightpressed" } }
]
},
"button_grid": {
"type": "grid",
"size": [ 200, "100%c" ],
"offset": [ 0, 20 ],
"anchor_from": "top_middle",
"anchor_to": "top_middle",
"grid_rescaling_type": "horizontal",
"grid_item_template": "mygrid.cell",
"collection_name": "form_buttons",
"bindings": [
{ "binding_name": "#form_button_length", "binding_name_override": "#maximum_grid_items", "binding_condition": "always" }
]
},
"list_window": {
"type": "image",
"texture": "textures/ui/dialog_background_opaque",
"size": [ 224, 140 ],
"layer": 60,
"controls": [
{ "close@common.close_button": {} },
{ "grid@mygrid.button_grid": {} }
]
},
"screen_router": {
"type": "collection_panel",
"size": [ "100%", "100%" ],
"factory": {
"name": "mygrid_screen",
"control_ids": { "g": "@mygrid.list_window" }
},
"property_bag": { "#§b§wmg:G": [ "g" ] },
"bindings": [
{ "binding_name": "#title_text" },
{ "binding_type": "view", "source_property_name": "('#' + ('%.10s' * #title_text))", "target_property_name": "#collection_length" }
]
}
}

ui/server_form.json inserts the router next to server_form_factory.

{
"namespace": "server_form",
"main_screen_content": {
"size": [ "100%", "100%" ],
"modifications": [
{
"array_name": "controls",
"operation": "insert_back",
"value": [ { "mygrid_router@mygrid.screen_router": {} } ]
}
]
}
}

The server sends an action form whose title is §b§wmg:G with a few buttons. With 5 buttons the cells lay in 2 columns, each cell showed the first 12 bytes of its button text, and pressing the fourth cell gave the server selection 3. A form with another title made no grid window {measured}. The vanilla form stays drawn behind.

How the rules map to the code:

  • collection_name is on the grid. On a panel or image it gives an Unknown property error (COL-01).
  • This example does not use collection_index. Whether a grid gives cells indexes automatically is {unverified} (COL-26), and collection_index, which fixes an index, is read only on a direct child of a parent that has collection_name (COL-02, COL-38, COL-44). If you need fixed cells, wrap the label in a panel and give the index to the panel reference (COL-02).
  • visible only stops drawing and does not stop creation and layout (COL-10), so for server forms other than this one, the router makes zero windows. Looking up property_bag with the first 10 bytes of the title and putting the result in #collection_length is the mechanism of HOST-06, COL-22 and COL-23.
  • Inside the window the router creates, the grid length and the cell's collection_details use binding_condition: "always". With the default condition they were empty on first open (COL-47, COL-48). The label inside the cell uses the order collection binding then view binding, with no condition (BND-37).

Left out because the wiki has no basis: a scroll area (with many buttons the grid overflows the window, and the scrolling setup is in the complete add-ons), a binding that hides the vanilla form for this title (it is in the add-on's server_form.json), and the window and cell sizes. A 2-column grid drew cells overlapping at 3000 buttons and more (COL-49).

Sources
idSourceLicenseCommitAccessed
repo-guideJSON UI comprehensive guide (this repository) (guide/)This project's material2026-11-13
bedrock-samplesMojang bedrock-samplesMinecraft EULA applies, (c) Mojang AB. All rights reserved15701fa9 (guide baseline 46ba6ea)2026-11-13
bedrock-wikiBedrock WikiCC BY 4.0 (docs/licenses/CC-BY-4.0.md in the repository)0930b392026-11-13
ms-learnMinecraft Creator documentation (Microsoft Learn)CC BY 4.0 (documentation), MIT (code)a9fd1c02026-11-13
private-researchPrivate research (-)-2026-11-13
bedrock-corebedrock-core UI (@bedrock-core/ui)MIT (confirmed in the repository LICENSE, Copyright 2026 bedrock-core)aee2bbd (analysis baseline, clone HEAD 51d5cf2)2026-11-13
advancementpackAdvancementPack (r4isen1920)MIT (confirmed in the repository LICENSE, Copyright 2024 r4isen1920)0a79929 (analyzed v4.2, researched 2026-10-20)2026-11-13
cinnabarCinnabar (json-ui crate)PolyForm Noncommercial License 1.0.0 (confirmed in the repository LICENSE). Used only to check behavior and as an implementation reference; the original text is not copiedceb0fb6 (analysis baseline, clone HEAD df826f5)2026-11-13
starlibv2StarLibV2GPL-3.0 (confirmed in the repository LICENSE)6bf78752026-11-13