Rules: Files and definitions
scripts/gen-rules.mjs builds this page from rules/*.json. Do not edit it by hand; edit the JSON and run npm run gen-rules. The rule bullets on topic pages (- **[ID]**) are filled from the same source.
Explanations and examples are on the topic page Files and definitions.
| ID | Rule | Level | Evidence environment | Source |
|---|---|---|---|---|
| FILE-01 | A new UI file is loaded only when its path is registered in the ui_defs array of ui/_ui_defs.json. Files at the same path as vanilla (ui/hud_screen.json, etc.) are already registered by vanilla, so they are not registered again. | vanilla, working pack | - | VN _ui_defs.json, AP-samples _ui_defs.json, BA, BW-intro |
| FILE-02 | A registered file is loaded even if its extension is not .json (for example ui/adv/_screen.r4ui). | working pack | - | AP 4.9, BW-intro |
| FILE-03 | A UI file is JSON that allows // and /* */ comments. | vanilla, working pack | - | VN header comments of all files, AP-samples |
| FILE-04 | ui/_global_variables.json is loaded automatically without registration, and $variables defined there can be used in all files. Vanilla also does not register this file in _ui_defs.json. | vanilla, working pack | - | VN _ui_defs.json and _global_variables.json, AP, MJ chapter 5, BW-intro |
| FILE-05 | A new file has one "namespace": "name". A merging file at the same path as vanilla works with vanilla's namespace even if the namespace is omitted. A checking tool flagging this as an error is a false positive. | working pack, inferred | - | AP-samples hud_screen.json, MJ chapter 5 |
| FILE-06 | "name@namespace.base": { … } inherits base to make a new definition and overrides properties. A definition in the same file can also be referenced as @base without a namespace. Even if a top-level definition inherits another namespace, a short name inside it is looked up in the file namespace (43 cases in vanilla, trade_screen_pocket.json:349). As an exception, a short name under an instance that inherits another namespace inside a control array ("x@common.close_button": { "controls": [...] }) is looked up in the base namespace (3 cases in vanilla; default@close_button_panel at command_block_screen.json:1010-1038 exists only in common). Inside such a control, write ns.name (FILE-42). | vanilla | - | VN throughout, NE |
| FILE-07 | A definition in another file is referenced as namespace.name. The location of a definition is decided by the file that owns it, so writing the same name in another file is treated as a different definition even in the same namespace. | measured | unknown | BC-facts |
| FILE-08 | An item { "childname@ns.definition": { …properties to override… } } inside a control array is the instantiation point. There are properties received only at the instantiation point, like collection_index (collections and factories chapter). | vanilla, measured | unknown | VN, BC-facts |
| FILE-09 | $name is a variable. Put it inside a definition as "$x": value or pass it at the reference point. "$x|default": value is the default used only when it was not passed from above (the reference point). | vanilla | - | VN |default 3,419 uses |
| FILE-10 | Variable substitution in an ordinary property works only when the whole value is a variable. "text": "$title" works, but in "text": "Title: $title" the $ is printed as is. If you need a combination, use a variable expression (FILE-11). | measured | unknown | BC-facts |
| FILE-11 | A variable value can be a parenthesized expression. Vanilla assembles binding names, texture paths and control names with it. Example: "$toggle_state_binding_name": "('#' + $dropdown_name)". | vanilla, working pack | - | VN ui_common.json:1126, AP 4.3 and 4.9 |
| FILE-12 | There are variables the engine puts in beforehand. Examples: $education_edition, $is_ps4, $pre_release (platform and build), $container_title of the chest screen, and $actionbar_text and $title_fade_in_time of controls created by HUD factories. Every screen receives 88 global names, and screen-only names exist separately. The server form and NPC screens receive only the 88 global names and have no screen-only names (the section on variables the engine provides). | vanilla, measured, code (binary) | Windows 1.26.65.1 | VN top values used in ignored, VN hud_screen.json:2158 and 2170, BC-facts, 2026-11-20 Windows 1.26.65.1 decompilation |
| FILE-13 | Each item of the variables array applies that item's variables when "requires": "<$variable expression>" is true. You may also write a single object instead of an array. | vanilla, working pack | - | VN arrays 274 and objects 4 uses, for example realms_settings_screen.json:2557, AP 4.6, BW-doc |
| FILE-14 | A control array can also be passed as a variable: "controls": "$target_control". It is a way to make a "child slot" in a template. | vanilla, working pack | - | VN 14 uses, for example persona_cast_character_screen.json:14, AP 4.2, BW-intro |
| FILE-15 | With "child@$variable" you can mount the definition the variable points to. Vanilla also uses it 413 times with a variable passed from the reference point (for example content@$button_content). But there is a measurement that nothing was drawn in one setup of the bedrock-core chest router (referencing a host that declares $gate|default twice with different $gate), and the cause was not checked. If mounting fails, write the definition name directly. | vanilla, working pack, measured | unknown | VN 413 uses, AP 4.8, BC-facts, BW-intro |
| FILE-16 | If "ignored": "<$variable expression>" is true, that control is not created at all (there is no binding or layout cost either). Use only $variables in the expression, and #bindings cannot be used. ignored is evaluated in the outer (parent) scope, not in that control's own $ declarations (FILE-34). | vanilla, measured, code (binary) | unknown | VN 958 uses, BC-S8, BW-best, NB-10 |
| FILE-17 | ignored is evaluated once at the time the control is created. So to split creation by runtime data, a route for the data to come in as a variable is needed. A control created by the HUD title factory (hud_title_text_factory) receives the title string as $title_text and the subtitle string as $subtitle_text, so it can be filtered with ignored or with the requires of variables. On Windows 1.26.65.1 a requires comparing $subtitle_text selected a block (FILE-47). Inside an ordinary server form screen there is no such route, so a factory length is used to branch at creation (collections and factories chapter). Variables the factory gives enter the outer scope of the created control, so the top-level ignored of that control can read them (FILE-34). | working pack, measured, code (source), inferred | Windows 1.26.65.1 | AP 4.1, BC-S8 and S11, CN, 2026-11-20 Windows 1.26.65.1 |
| FILE-18 | ignored can also be attached to an array element, like one item of button_mappings. | vanilla, working pack | - | VN gameplay_common.json:272, AP 4.3 |
| FILE-19 | In the variable expressions of ignored/requires, $v > 'a' was used to tell whether it is a string. $v > 0 does not tell whether it is a number: a > with a string on only one side is true when the left reads as true and the right reads as false, so a non-empty string is also true (on Windows 1.26.65.1 'abc' > 0 was true). So the item_icon of the AP original below is created even when $icon is a texture path. Filter the number-side cell when ($icon > 'a') is true (code). ignored cannot see its own $ declarations and values received at the reference point (FILE-34), so attach it to a child of the control that receives the variable. The example below is the form of the AP original. | working pack, code (source), measured | Windows 1.26.65.1 | AP 4.7, CN, AP-samples _screen.r4ui:321, 2026-11-20 Windows 1.26.65.1 |
| FILE-20 | If you use a path key like "parent/child/grandchild": { … } in a file at the same path as vanilla, it overrides only the properties of a deep vanilla control. Vanilla itself does not use this syntax (0 uses). | working pack | - | BA chapter 2 main_screen_content/server_form_factory, AP 4.9 recipe_unlocked_popup/input_panel/label_panel/horizontal_padding_1, BW-intro, BW-best |
| FILE-21 | If you write a definition with the same name as vanilla in a same-path file, it is merged per property (only the properties written change). Example: specify only the two properties force_render_below and screen_draws_last on in_bed_screen. Measured on Windows 1.26.65.1, three packs each did an insert_back into main_screen_content of server_form from their own same-path file, and all three routers existed (modifications accumulate, claim measurements). On the same property the pack higher in the world pack list won: when two packs set size of chat_grid_item/chat_background to "50%" (lower pack) and "75%" (higher pack) in the same-path hud_screen.json, the chat background width was 570 (75% of the 760 parent). The game restored its own pack order on world entry, so the reverse order was not measured (record). | working pack, measured | Windows 1.26.65.1 | AP-samples in_bed_screen.json and toast_screen.json, BC 6.3-9, BW-best, 2026-11-18 and 2026-11-19 Windows 1.26.65.1 |
| FILE-22 | If you redeclare a vanilla definition in a file with a different name, it is ignored. A redeclaration is valid only in a file at a path vanilla owns. | measured | unknown | BC-facts |
| FILE-23 | property_bag holds initial values of #property. It is used for defaults before a binding has written a value, for renderer input (#item_id_aux), and for routing dictionaries (screen hosts and data channels chapter). | vanilla, working pack | - | VN 240 uses, AP 4.7, BC 4.1 |
| FILE-24 | The size, offset and alpha values put in property_bag are not applied. Only a binding can change these three. | measured | unknown | BC-S12 |
| FILE-25 | The path in _ui_defs.json is the full path from the resource pack root to the extension. The wiki says folders outside ui/ (my_ui/main_menu.json) also work. Vanilla and this project's working packs all use only below ui/, so check before using anything outside ui/. | unverified | - | BW-intro |
| FILE-26 | A namespace is said to allow a prefix (with "namespace": "wiki:main", write "x@wiki:main.element"). It is for reducing the chance of colliding with vanilla namespaces. There is no usage example in vanilla or this project's sources. | unverified | - | BW-best |
| FILE-27 | If the child that a path key ("parent/child") points to does not exist, a resource pack error is left in the Content Log but the rest of the UI works normally. Path keys are the contact point that breaks first when vanilla is reworked, so if you can override the definition itself, use that. | unverified, inferred | - | BW-best |
| FILE-28 | When using engine-provided variables ($actionbar_text, etc.) in an expression, receive them once as your own variable ("$atext": "$actionbar_text", "visible": "(not ($atext = 'x'))"). In an unnamed chest, a label with visible: "($container_title = 'container.chest')" was hidden and the label with "not" added was shown (the direct comparison is false), and a label with ($copy = 'container.chest') received through "$copy": "$container_title" was shown (true). In the code $container_title and $actionbar_text are not strings but objects with the keys __string, __rawtext and value, while $title_text and $subtitle_text are plain strings. $actionbar_text came out the same: after /title @s actionbar xyz, a ($actionbar_text = 'xyz') label was hidden and the (not ...) label was shown, and a ($copy = 'xyz') label received through "$copy": "$actionbar_text" was shown. The reason is in the code: the only place that unwraps the object into its value string is the property value resolver, and it unwraps only when the whole property value is a single $name. A $name inside an expression is looked up by the expression parser as the object itself, so a direct comparison is always false (EXP-34). The $ keys of a definition and variables values go through that resolver into the local scope, so the copy is the unwrapped string (HOST-19, HOST-48). AP's "$title_text|default": "" declaration appears to have the same effect. | measured, code (binary), inferred | Windows 1.26.65.1 | BW-intro, AP 4.1, 2026-11-23 Windows 1.26.65.1, 2026-11-24 Windows 1.26.65.1, 2026-11-24 decompilation |
| FILE-29 | Of the global platform variables the engine sets, those the vanilla 1.26.50 UI actually references: $pocket_edition, $win10_edition, $osx_edition, $console_edition, $education_edition, $is_console, $is_desktop, $is_ios, $is_ps4, $xbox_one, $touch, $pocket_screen, $desktop_screen, $is_pregame (out-of-game screens), $is_publish, $pre_release, $trial, $store_disabled, $is_holographic, $apple_os, $google_os, $microsoft_os, $nx_os and others, 34 in all. The remaining 21 of the wiki list's 55 ($game_pad, $mouse, $fire_tv, $gear_vr, etc.) do not appear in vanilla UI files. In the Windows 1.26.65.1 client code the four names given as examples are all among the 88 globals. The only input-mode name is $game_pad; there is no $gamepad (the section on variables the engine provides). Values measured on the HUD matched the code, and a pack _global_variables.json cannot override the same name the engine sets. | vanilla, code (binary), measured | Windows 1.26.65.1 | BW-doc Global Variables, VN exhaustive search, 2026-11-20 Windows 1.26.65.1 decompilation |
| FILE-30 | UI files are read with jsoncpp rules. Comments and leading zeros are fine, but trailing commas and unquoted keys are errors. When an error occurs, only the definitions read up to that point are loaded and the rest silently drop out. If the first file at the same path fails, overrides from later packs are not accepted either. Measured on Windows 1.26.65.1, a trailing comma in a definition in the middle of a file let the definitions before the error and the erroring definition load, and the definition after it dropped out. It did not drop silently: the log showed UI control reference not found: 'b'. When the middle definition had an unknown type (no_such_type), the definitions before and after both loaded and the log showed Type 'no_such_type' not ... (claim measurements). | code (source), measured | Windows 1.26.65.1 | CN, 2026-11-18 Windows 1.26.65.1 |
| FILE-31 | The paths in _ui_defs.json are read once each in sorted order. If several files redefine the same definition, the last by path name wins. | code (source) | - | CN |
| FILE-32 | If a key without @ has a dot, what is before the dot is read as the namespace ("spacer_9.5" becomes namespace spacer_9, name 5). Do not use dots in control names. "@.name" is the same file's namespace. | code (source) | - | CN, CN regression test Lifeboat |
| FILE-33 | $variable lookup finds a fixed value first. If there is a "$x": value anywhere outside, it beats the inner "$x|default", and only when there is no fixed value is the nearest |default used. null means unset. | code (source) | - | CN, CN-run |
| FILE-34 | ignored does not see that control's own $ declarations. Neither the $x|default inside the definition nor the "$x": true passed at the reference point reaches its own ignored, and it reads only the value of the parent (outer) scope. Pass the gate variable to the parent and put ignored on that child (the hover_slot of vanilla focus_border and the child of AP category_tab_icon have this form). The engine evaluates ignored before that control's variables (FILE-43). Measured on Windows 1.26.65.1, with top-level "ignored": "$hide" and "$hide|default": false in the definition and "$hide" given as true, false or omitted at the reference point, all three controls were created and each time the log warned Expected variable not found in ancestor tree: '$hide' (claim measurements). | code (source), code (binary), vanilla, measured | Windows 1.26.65.1 | NB-10, CN and CN-run ($x|default and reference-point values), 2 of 146 VN reference points pass variables, AP-samples, 2026-11-18 Windows 1.26.65.1 |
| FILE-35 | If the result of ignored is a boolean it is used as is, an integer is "not created if not 0", and a string is created. An unset $variable is null inside an expression, but when the whole value is like "ignored": "$x" it stays as the text $x and is created. | code (source) | - | CN |
| FILE-36 | A child key can also be a variable: in { "$slot": { …properties to override… } }, if $slot is "name@ns.definition", it is created with that name and definition. You can also give only the instance name as a variable, as in "$name_var@ns.definition". | vanilla, code (source) | - | VN 83 uses, for example base_tab in ui_template_tabs.json, CN |
| FILE-37 | In inheritance, a property the derived definition writes replaces the base's wholesale, even if it is an object. In contrast, redeclaration in a same-path file (FILE-21) merges object values member by member. To change only part of property_bag, redeclare, and to change all, inherit. | code (source) | - | CN |
| FILE-38 | A "property": null in a top-level definition erases the base value, but a null in an inline reference inside a control array leaves the base value as it is. | code (source) | - | CN |
| FILE-43 | For each control the engine evaluates ignored first, and if true it does none of the remaining processing for that control, including applying variables. So values set by its own variables (including conditional variables) do not reach its own ignored (FILE-34). Putting a real number, array or object in ignored gives the error An invalid value was provided for "ignored" field.. variables accepts one object or an array of objects, and items in the array that are not objects are skipped. | code (binary) | unknown | NB-10 |
| FILE-44 | A variables block without requires is not applied. The engine treats a missing requires as null and skips that block. Put values that always apply outside variables as $ keys, or write "requires": true. Measured again per entry on 2026-11-24: a text: "$vt" label with "$vt|default": "DEF" and variables: [{"$vt": "NOREQ"}] showed DEF, and a text: "$vo" label with only variables: [{"$vo": "ONLY"}] drew the literal $vo and logged the warning Expected variable not found in ancestor tree: '$vo'. An entry with a true variable in requires was applied and showed REQ. | measured, code (binary) | Windows 1.26.65.1 | 2026-11-20 Windows 1.26.65.1, 2026-11-20 decompilation, 2026-11-24 Windows 1.26.65.1 |
| FILE-45 | requires and ignored have no binding context, so #x evaluates to the text #x, not to null. "requires": "(#x)" applied the block and "requires": "(not #x)" did not. "ignored": "(#x = '#x')" left the control not created, and "ignored": "yes" left it created (only booleans and integers have an effect in ignored, FILE-35 and FILE-43). So requires and ignored cannot test binding values (FILE-16). | measured, code (binary) | Windows 1.26.65.1 | 2026-11-20 Windows 1.26.65.1, 2026-11-20 decompilation |
| FILE-46 | Do not use an undefined $variable in the requires of variables. On Windows 1.26.65.1, a requires with $nosuch_var, defined nowhere, piled up more than 340,000 lines of Expected variable not found in ancestor tree: '$nosuch_var' in the content log and froze the game, which had to be force quit. Declare every variable that a requires reads on that control or an ancestor, at least with |default. | measured | Windows 1.26.65.1 | 2026-11-20 Windows 1.26.65.1 |
| FILE-47 | A variables block whose requires compares $subtitle_text can select a JSON integer to put in the property_bag, 64-bit integers included. $id selected with { "requires": "($subtitle_text = '-8589934591')", "$id": -8589934591 } and put in "property_bag": { "actor_id": "$id" } made actor_portrait_renderer draw that entity. A variable holding a JSON integer stays an integer when substituted into the property_bag. Bindings cut integers to 32 bits (BND-38), so put 64-bit values in this way. | measured | Windows 1.26.65.1 | 2026-11-20 Windows 1.26.65.1 |
| FILE-48 | Label text starting with ( is computed as an expression. When text, or a $variable value passed to text, started with (, it was computed as an expression. (v-0)*.01, (20.0-15)/max and (.25) logged the warning JSON UI parse failure - expected a string. and the text was empty. In the code, too, the property value resolver computes a string starting with ( as a constant expression and tries again. To show text that starts with a parenthesis as is, put another character before it {inferred}. Passing it as a __rawtext object also works: text: "$raw" receiving the pack-made "$raw": {"__string": true, "__rawtext": true, "value": "(1 + 2)"} drew (1 + 2). With __rawtext removed from the same object it was not the 3 the code predicted but empty, with the same warning. The copy variable of a chest named (1 + 2) was the same (HOST-48). By the same resolution, text: "$cut" receiving "$cut": "('%.3s' * 'abcdef')" was abc (EXP-57). | measured, code (binary) | Windows 1.26.65.1 | 2026-11-24 Windows 1.26.65.1, 2026-11-24 decompilation, 2026-11-25 Windows 1.26.65.1 |
| FILE-49 | A number screen variable cannot be used directly in text. text: "$container_size" on the chest screen and text: "$max_messages" and text: "$max_text_edit_length" on the chat screen logged the warning JSON UI parse failure - expected a string. and were empty, and text: "$max_page_length" on the book screen was empty too. To show it as text, put a string key such as "#z": "CS" in property_bag and put the view binding (#z + $container_size) into #text (CS27). ('CS' + $container_size) without a # property is dropped at load (BND-42). Boolean global variables put in text gave the same warning (the section on variables the engine provides). | measured | Windows 1.26.65.1 | 2026-11-25 Windows 1.26.65.1 |
Proposed rules
These proposals are not merged into the adopted rules yet. Check the evidence before using them.
| ID | Rule | Level | Evidence environment | Source |
|---|---|---|---|---|
| FILE-39 | Name siblings in the same controls array differently (the name before @). There are reports that from a version around April 2025 duplicate names cause JSON UI errors (StarLibV2 1.0.3.3), and none of the 5,084 controls arrays of vanilla 1.26.50 has a duplicate. Split a common name like padding into padding_top and padding_bottom. On Windows 1.26.65.1 the reported error does not occur. Two dup siblings in one controls array and two re9dup@re9.tl in the HUD were all created and shown side by side, and the Content Log had no line about that name (claim measurements). The code agrees: building controls walks the controls array in order and only appends each child to the parent's child list without comparing names, and the executable has no message reporting a duplicate JSON UI control name. A name lookup picks only the first sibling. So the second sibling of a duplicate name becomes an ordinary control the button does not handle. With two siblings named default_control (CD_A, CD_B in that order) on a button in the HUD and on the chat screen, both are shown with no input; when the mouse is over the chat screen button, only CD_A, first in the array, is hidden and the hover control re9ch is shown, while CD_B stays shown regardless of the button state. When the mouse leaves, CD_A is shown again. | working pack, vanilla, measured, code (binary) | Windows 1.26.65.1 | SLB, bedrock-samples, 2026-11-18, 2026-11-24, 2026-11-25 Windows 1.26.65.1, 2026-11-24 decompilation |
| FILE-40 | A \uXXXX escape in keys and string values is decoded into the original character when read. A file converted with escapes only gets bigger and the meaning (the byte count of an expression, comparison, containment check) is the same, and anyone can revert it with a JSON parser, so it has no effect if the purpose is hiding. The small pack escape tool (JSON-Escape) writes a character outside the BMP as a five-digit escape, which breaks the character. A character outside the BMP must be written as a surrogate pair. Not checked: whether a definition that writes the "type" key and the "label" value with \u escapes works, and whether a label that writes an emoji outside the BMP as a surrogate pair is drawn. | code (source), unverified | - | JEN, SP |
| FILE-41 | The vanilla 1.26.50 UI puts one namespace in only one file. References still resolve when the definitions of one namespace are split across several files (a claim of the obfuscator JsonEncryptor). On Windows 1.26.65.1, juc_split.outer (file 1) referencing juc_split.inner (file 2) created the child (claim measurements). If there is no reason to split, keep one file per namespace. | vanilla, measured | Windows 1.26.65.1 | bedrock-samples, JEN, 2026-11-18 Windows 1.26.65.1 |
| FILE-42 | An @name without a namespace is looked up in different namespaces depending on context. There are 43 cases in vanilla where, even if a top-level definition inherits another namespace, the short name inside it is looked up in the file namespace (trade_screen_pocket.json:349), and 3 cases where a short name under an instance that inherits another namespace inside a control array ("x@common.close_button": { "controls": [...] }) is looked up in the base namespace (default@close_button_panel at command_block_screen.json:1010-1038 exists only in common). Inside a control that inherits another namespace, always write ns.name. Conflict C-55. Not checked: which one wins when both namespaces have the same name. | vanilla, conflict | - | NE, bedrock-samples |
| id | Source | License | Commit | Accessed |
|---|---|---|---|---|
repo-guide | JSON UI comprehensive guide (this repository) (guide/) | This project's material | 2026-11-13 | |
private-research | Private research (-) | - | 2026-11-13 |