Skip to main content

Controls and layout

Concept: controls form a tree, and layout is decided by size, anchors and stacks​

A screen is a tree of controls. Children go in the parent control's controls array, and a child is placed inside its parent by size (size), reference points (anchor_from/anchor_to), movement (offset) and overlap order (layer). If the parent is a stack_panel, children are stacked in one direction, and if it is a grid, they are placed in cells.

A working example​

An info card attached to the top right of the screen. A title label and a body label are inside a vertical stack, and the card shrinks to fit its children.

{
"namespace": "my_addon",
"info_card": {
"type": "panel",
"size": ["100%c + 8px", "100%c + 8px"], // Sum of children + margin
"anchor_from": "top_right", // Attach to the parent's top right
"anchor_to": "top_right", // and align its own top right
"offset": [-4, 4], // Push inward (for a right anchor, negative x is inward, LAY-17)
"controls": [
{ "bg": { "type": "image", "texture": "textures/ui/white_icon",
"color": [0, 0, 0], "alpha": 0.6, "layer": 1,
"size": ["100%sm", "100%sm"] } }, // A background matched to the largest sibling
{ "rows": {
"type": "stack_panel", "orientation": "vertical", "layer": 2,
"size": ["100%c", "100%c"],
"controls": [
{ "title": { "type": "label", "text": "Title", "color": [1, 1, 0] } },
{ "body": { "type": "label", "text": "Body", "size": ["default", "default"] } }
] } }
]
}
}

The size "100%c" is the sum of visible children and "100%sm" matches the largest sibling (LAY-03, LAY-07). Giving the background a low layer guarantees front and back order (LAY-19).

The Bedrock Wiki property table (with defaults)​

Excerpt: JSON UI Documentation, Control and Layout properties · docs/json-ui/json-ui-documentation.md · Bedrock Wiki · License CC BY 4.0 (docs/licenses/CC-BY-4.0.md in the repository) · Commit 0930b39
PropertyTypeDefaultDescription
visiblebooleantrueIf the UI element should be visible
enabledbooleantrueIf true and the element or any child has the locked state then they will be in the locked state
layerint0Z-Index relative to the parent element. Higher values render above, negative values render below the parent element
alphafloat1.0Alpha of the element. It will only affect the UI element. Its children will be unaffected. Use propagate_alpha to apply to children too
propagate_alphabooleanfalseIf alpha should apply to all children as well
clips_childrenbooleanfalseCuts off visually and interactively everything beyond the boundaries of the UI element
allow_clippingbooleantrueIf clips_children of an ancestor works on this element
use_child_anchorsbooleanfalseUse the anchor_from and anchor_to of the children of the UI element
grid_positionVectorPosition that the control will take inside the grid. Also allows modifying specific grid items of a hardcoded grid
collection_indexintIndex that the control takes in the collection
sizeVector [width, height]["default", "default"]"default", a number of pixels (0 or "0px"), a percentage of the parent ("50%"), and sums such as "100% - 4px"
max_size, min_sizeVector["default", "default"]Maximum and minimum size the element can have
offsetVector [x, y][0, 0]Position relative to the parent, based on the top left corner
anchor_fromenumcenterAnchor point in the parent element
anchor_toenumcenterAnchor point in the element
orientationenumverticalDirection the elements stack inside stack_panel (vertical, horizontal)
grid_dimensionsVector [columns, rows]Number of columns and rows the grid has
maximum_grid_itemsintMaximum number of items the grid will generate
grid_item_templatestringAn element capable of handling collections

Anchors allow the elements to align to a certain point. anchor_to is the anchor point in the element that will be attached to the anchor_from in the parent element. For anchor_from: center and anchor_to: top_left, the top left point of the element is in the center point of the parent element.

Note: the "default" size differs per type (LAY-03). grid_position is [column, row] (LAY-29). Vanilla uses only vertical for grid_fill_direction (LAY-26). allow_clipping is inherited from the parent when omitted, and is true only for a control without a parent (LAY-68).

The element property reference of Microsoft Learn​

The MS Learn minecraft:ui_element document (commit a9fd1c0) lists element properties by name, type and description (Source: ms-learn). The main items this wiki treats as rules are as follows.

CategoryProperties
Size and placementsize ([width, height], numbers are pixels, '100%', 'fill', '100%c', '100%cm'), min_size, max_size, offset ([x, y] pixels), anchor_from, anchor_to, layer (higher is on top), orientation
Displayvisible, alpha (0.0~1.0), propagate_alpha, color ([r, g, b]), clips_children, allow_clipping, ignored, shadow, grayscale
Texturetexture, uv, uv_size, tiled, keep_ratio, bilinear, nine_slice_left/top/right/buttom (original spelling), fill
Texttext, text_alignment, font_size, font_type, font_scale_factor, max_length, place_holder_text
Collection and gridcollection_name, grid_dimension_binding, grid_item_template, grid_rescaling_type, factory, bindings, variables, controls
Input and focusbutton_mappings (from_button_id, to_button_id, mapping_type, input_mode_condition), focus_enabled, focus_change_up/down/left/right, default_focus_precedence, modal, consume_event, prevent_touch_input
Scroll and sliderscroll_content, scroll_view_port, scrollbar_box, scrollbar_track, scroll_speed, slider_range, slider_steps
Accessibilitytts_control_type_order_priority, tts_ignore_count, tts_skip_message

The enum tables of this document (types, anchors, etc.) are empty and some names (scrollbar_track, nine_slice_buttom) differ from vanilla. Judge types by vanilla usage (the control types table below) (LAY-01). The scroll track type is scroll_track.

Rules​

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. 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. LAY-59~LAY-68 are layout rules read from the native client decompilation (NB, Windows 1.26.65.1 and Android 1.26.52.3) and measured in game on Windows 1.26.65.1 (2026-11-20). The measuring window is the test window juc_tester.json of the add-on addons/json-ui-claims (server form title §b§wjc:t, opened with /scriptevent bwiki:json_ui_claims t), and the setup is in claim measurements. LAY-69~LAY-71 are read from a decompilation of the Windows 1.26.65.1 client (2026-11-24). The same day's measurements are in section 6.8 of claim measurements, and LAY-69 and LAY-70 were not measured in game.

Control types​

These are the values used as "type" in vanilla 1.26.50.4 and their counts (VN exhaustive search). Note that they differ from the official enum (forms/ui/ui_element.form.json).

TypeVanillaOfficial enumUse
panel4,092OAn empty box. Child placement, binding host
stack_panel1,461OStacks children in one direction
image1,318OTexture
label814OText
grid132OGrid, collection
input_panel108OA panel that receives input (hover, drag, modal)
custom105OWhat the engine draws through renderer
button54OButton (mostly written with the common_buttons.* templates)
factory36XA factory control that creates controls per kind of data (collections and factories chapter)
screen7OScreen root
collection_panel3XCollection + factory host
scroll_view, scrollbar_box, scroll_track2, 1, 1O, O, XScroll components
edit_box, toggle, slider, slider_box, dropdown2, 1, 1, 1, 1OMostly used through templates
tooltip_trigger, selection_wheel, label_cycler, image_cycler, grid_page_indicator, carousel_label2, 1, 1, 1, 1, 1XSpecial
  • [LAY-01] Judge the list of valid types by vanilla usage, not by the official enum. The official enum is missing types vanilla uses, such as factory, collection_panel, tooltip_trigger and scroll_track. The scroll track type is scroll_track (scrollbar_track is not a type), and the legacy types tab, grid_item and scrollbar never appear in vanilla. carousel_label, which the wiki classifies as legacy, remains once in vanilla, but the Windows 1.26.65.1 engine rejects it as an unknown type and does not create it (ANI-46). {vanilla, measured} (Source: VN, BC-facts official schema section, BW-doc, 2026-11-20 Windows 1.26.65.1)
  • [LAY-02] scroll_box is not a type but a control name in ui_common.json. Do not assemble scrolling by hand; reuse the common.scrolling_panel template with variables such as $scrolling_content. {vanilla, working pack} (Source: VN server_form.json scrolling_panel@common.scrolling_panel, BA chapter 5, AP, MJ 4.2-2)
  • [LAY-70] screen_not_flushable is a boolean read only by type: screen controls and defaults to false. The value is stored as a bit of the screen component and a screen getter returns that bit, but the screen stack code that calls the getter was not found. From the name it looks like a mark that keeps this screen when the screen stack is flushed all at once, but the effect is inferred. {code (binary), inferred} (Source: 2026-11-24 Windows 1.26.65.1 decompilation)

Size​

NotationMeaningVanilla
16 or "16px"Pixelspx 2,606
"50%"A ratio of the parent sizemany
"100%c"Size based on children. In both stack panels and plain panels, the sum of visible children (grids: LAY-03)2,201
"100%cm"The largest child419
"100%sm"The largest sibling263
"100%x", "100%y"A ratio of its own other axis size (square, fixed ratio)162, 150
"fill"The remaining space in a stack panel668
"default"The default size of the content (label text, etc.)963
"100% - 4px", "100%c + 12px"Expression%c + 288
  • [LAY-03] Use the size keywords in the table above. The meaning "based on the other axis" for %x/%y was judged from a vanilla comment (25%x * 56.25%) and usage. "default" was the same as an omitted size and differs by type. Measured on Windows 1.26.65.1, a panel was 100% of the parent, a label the text size (Hello 24x10), a vertical stack panel 100% of the parent wide and the sum of its children high, and a grid the extent of its children (a 2x2 grid of 10x10 cells was 20x20) (claim measurements). Only a panel equals "100%" on both axes. In the code this grid size is not the extent of the children but dimensions x template size, so the value is the same but it is measured by the dimensions even when there are fewer items than the dimensions (2026-11-24 decompilation). In the Cinnabar reconstruction, an omitted size is 100%c if it is the main axis of a stack panel, the texture ratio for a ratio image, and the parent size otherwise (LAY-38). In size expressions %c and the like are written after % (LAY-36). {vanilla, code (source), code (binary), inferred, measured} (Source: VN store_search_screen.json:64 comment, VN exhaustive search, BW-doc, CN, 2026-11-18 Windows 1.26.65.1, 2026-11-24 Windows 1.26.65.1 decompilation)
  • [LAY-04] A stack panel gives no space to hidden (#visible false) children. Collapsing a conditional row pulls what is below up, and turning power-of-two spacers on and off makes the sum the coordinate (pattern recipe 6). {working pack, measured} (Source: BA chapter 4, BC-S12)
  • [LAY-05] The position (offset) of a static control changes when a view binding copies a property_bag key that holds an array to #offset. In the Windows 1.26.65.1 HUD, a label with a static "offset": [70, 0], "property_bag": {"#o": [10, 20]} and a view binding from #o to #offset moved to the (10, 20) GUI position (it replaced the static offset). A label with only "#offset": [10, 20] in property_bag and no binding stayed at its static [30, 0] position. The Cinnabar reconstruction also accepts an [x, y] binding on #offset. The code is the same: when the #offset property bag key holds an array, [0] and [1] are read as floats, the offset becomes two pixel terms and layout is redone. If it is not an array, (0, 0) is used, and nothing happens when that equals the current expression. A binding expression only yields a boolean, integer, float or string, so an expression cannot compute an array. So for a position that changes with a value, bind the size of a spacer placed before it so the stack pushes the next child. {measured, working pack, code (source), code (binary)} (Source: BC-S12, BA chapter 4, CN, 2026-11-24 Windows 1.26.65.1 decompilation, 2026-11-25 Windows 1.26.65.1)
  • [LAY-06] Make responsiveness with max_size and min_size. Example: with "size": [314, "100% - 64px"] and "max_size": [314, 236], the window height shrinks on small screens. {working pack, vanilla} (Source: BA chapter 5, VN max_size 204 uses)
  • [LAY-07] If you put a background as "100%sm" inside a "100%cm" box, when a row inside hides, the box and background shrink together and what is below follows up. {measured} (Source: BC-S12)
  • [LAY-08] If you put a label and a "100%sm" button inside a "100%cm" panel, the button hitbox fits the text size exactly in each language. Using "100%c" in the same place makes the button fall below the label. {measured} (Source: BC-S10)
  • [LAY-09] When putting an icon-only button in a row whose height is set by its children, give an explicit square size. A percentage height does not decide the row height. {measured} (Source: BC-rules)
  • [LAY-34] The size keywords "fill" and "default" are keywords only when exactly in lowercase. A unitless numeric string ("10") becomes 0. Write it as a number or as "10px". A space is not a separator, and the last number remains after a term is made (LAY-63). {code (source)} (Source: CN-run)
  • [LAY-35] The sign in a size expression carries on to the next sign: "100% - 10px 5px" is 100% - 15px. Write a sign on every term. {code (source)} (Source: CN-run)
  • [LAY-36] %c, %cm and %sm are written after %. "100c%" and "50c%" in vanilla progress_screen.json are read as parent-based %. On Windows 1.26.65.1, inside a 210-wide parent, a ["100c%", 10] panel (child 30x10) was 210x10 and a ["50c%", 4] panel was 105x4. In the code the parser treats only the token after % as a modifier and ignores a separate c. {vanilla, code (source), code (binary), measured} (Source: VN progress_screen.json:21, 31 and 48, CN-run, 2026-11-24 Windows 1.26.65.1 measurement and decompilation)
  • [LAY-37] %cm and %sm ignore the coefficient and are the maximum value itself. "50%cm" is also the largest child size. On Windows 1.26.65.1, a ["50%cm", 10] panel was 90 wide with children 30 and 90 wide (not half 45, not half the sum 60, not a fixed 50), and [10, "50%cm"] was 30 high with children 10 and 30 high. ["100%cm", "100%cm"] was 40x20 with children 30x10 and 40x20. In the code a %cm term stores no coefficient or sign and is the maximum of the child sizes (starting at 0). If you need half, shrink again with % in a wrapping panel. {code (source), code (binary), measured} (Source: CN-run, CN tests G06 and G07, 2026-11-24 Windows 1.26.65.1 measurement and decompilation)
  • [LAY-64] %cm ignores the sign as well as the coefficient (LAY-37). "50px - 100%cm" with a 20-wide child was 70. A %cm term is added even with a - in front of it. {code (binary), measured} (Source: NB, 2026-11-20 Windows 1.26.65.1)
  • [LAY-63] In a size string a space is not a separator, and the last number remains after a term is made and is reused by the next unit. In a 100-wide parent, "50px%" and "50px %" were both 50px + 50%, which is 100, and "10px px" was 20. Write a number for every unit (LAY-34, LAY-35). {code (binary), measured} (Source: NB, 2026-11-20 Windows 1.26.65.1)
  • [LAY-61] A size value must be an array. A non-array value such as "size": 20 makes both axes default, and the panel was 100% of the parent. To give both axes the same value, write [20, 20]. {code (binary), measured} (Source: NB, 2026-11-20 Windows 1.26.65.1)
  • [LAY-59] The 100%c of a plain panel is also the sum of the sizes of its visible children. A panel with children of 30x10 and 50x20 and a hidden 40x40 was 80x30. Even when children overlap it is a sum, not an extent, so use 100%cm to fit the largest child (LAY-52). On 2026-11-24 a ["100%c", "100%c"] panel with children 30x10 and 50x20 was also 80x30. In the Windows 1.26.65.1 code, %c of every non-grid type adds a "coefficient x child size" term per child (a grid uses dimensions x template size), and hidden children (JSON visible false, hidden by a binding) have a size node of 0 and drop out of the sum. {code (binary), measured} (Source: NB, 2026-11-20 Windows 1.26.65.1, 2026-11-24 Windows 1.26.65.1 measurement and decompilation)
  • [LAY-39] Minimum and maximum are applied as: the maximum if the value is above it, otherwise the larger of the value and the minimum. So if minimum and maximum conflict (min > max), a value above the maximum is clipped to the maximum, and a value at or below the maximum gets the minimum. On Windows 1.26.65.1, size 10 with minimum 50 and maximum 30 gave 50. fill outside the stack's main axis is 0. {code (source), code (binary), measured} (Source: CN, NB, 2026-11-20 Windows 1.26.65.1)
  • [LAY-62] min_size and max_size also accept child-based terms such as %c. A control with "min_size": ["100%c", 0] and a 30-wide child was 30 wide. {code (binary), measured} (Source: NB, 2026-11-20 Windows 1.26.65.1)
  • [LAY-65] Several fill children on a stack's main axis split the remaining space equally. In a 100-wide horizontal stack with a fixed 20 child and two fill children, the fill children were 40 and 40. {code (source), measured} (Source: CN, 2026-11-20 Windows 1.26.65.1)
  • [LAY-66] A stack's orientation reads only the lowercase horizontal and vertical. A value with different case such as "Horizontal", or an unknown value, stacked vertically. {code (binary), measured} (Source: NB, 2026-11-20 Windows 1.26.65.1)
  • [LAY-40] With a stack's use_priority: true, when the sum of children overflows, children with the lowest priority are kept first (0 or lower always kept) and children that do not fit are hidden. {code (source)} (Source: CN test S05)
  • [LAY-72] On a child of a use_priority: true stack, "priority_rule": "show_when_controls_are_hidden" takes the child out of the overflow count (LAY-40) and shows it only when another child overflowed and was hidden. Use it for a "more" marker. In a 100 wide horizontal stack with three 40 wide labels (priority 1, 2, 3) and a 20 wide marker, the third label was hidden and the marker shown. With only two labels everything fit and the marker was hidden. Given to an ordinary child, the child is hidden unless another child is hidden. It had no effect in a stack without use_priority, and it was hidden along with the HUD on F1. The other value is default. {measured, code (binary)} (Source: 2026-12-03 Windows 1.26.65.1 measurement and decompilation)
  • [LAY-69] A control with inherit_max_sibling_width: true computes its width and then takes the largest of its own width and the widths of all the parent's children (itself included) that have a layout. inherit_max_sibling_height does the same on the height axis. Both are booleans read by every control and default to false. There is no visibility check, but a hidden sibling has a size node of 0 and has no effect. Whether min_size/max_size is applied again to the result, and how many passes run when two siblings both turn it on, is unknown. {code (binary)} (Source: 2026-11-24 Windows 1.26.65.1 decompilation)
  • [LAY-51] Putting two columns as two vertical stacks in a horizontal stack_panel gave height 0. Put two vertical stacks attached to the top left and top right inside a panel (height 100%cm). {measured} (Source: DF)
  • [LAY-52] With a left panel and a right detail in a horizontal stack, 100%c added the two heights and 100%cm collapsed the right detail. Put the panels inside a panel with a top-left reference and offset, and give that panel a height of 100%cm (the largest child) (LAY-51). The 100%c of a plain panel is also the sum of visible children, so it adds the two heights (LAY-59). {measured} (Source: DF, 2026-11-20 Windows 1.26.65.1)
  • [LAY-53] Fitting the window height to the content with 100%c made the window and content refer to each other and collapse (buttons went outside the window). Keep a server form window at a fixed pixel size and handle overflowing content with an inner scrolling_panel or server-side paging. Phones draw the UI large, so a window bigger than the vanilla inventory (326x166) does not fit on screen. {measured} (Source: DF)
  • [LAY-54] Making a list cell the content height (100%c + 8px) made an empty list a thin bar and let a long list go outside the window. Fix the list cell to the window height and put common.scrolling_panel inside it. If you fix a button cell at a fixed height, a scrollbar appears when a body is attached above it, so use a stack_panel 100%c so that it takes only as much as the buttons. {measured} (Source: DF)

Size, position and opacity bindings​

  • [LAY-10] A size binding writes values to #size_binding_x and #size_binding_y. The value is a multiple of the parent size, not pixels. Measured on Windows 1.26.65.1, a declared 10x10 child in a 100-wide parent got width 50 for .5 and width 200 for 2, past the parent, and #size_binding_x_absolute 20 gave 20 (claim measurements). The Cinnabar reconstruction does the same (value v becomes v x 100%, _absolute is pixels). So inside a [1, 1] size frame the value becomes pixels. Keep the declaration as ["100%", "100%"]. With a [0, 0] declaration an unbound axis stays 0 and nothing is drawn (LAY-11). Vanilla's only size binding (resizing_xp_bar_with_hotbar) is used with use_anchored_offset: true, but on a static control the result was the same 50 without it (measured on Windows 1.26.65.1). Avoid the combination of a size binding + use_anchored_offset + a collection cell (LAY-14). The offset binding #anchored_offset_value_x (use_anchored_offset: true) was a multiple of the parent width in game: 50 in a [1, 1] frame and 0.5 in a 100-wide frame both landed at 50px, and 50 in a 100-wide frame went outside the frame. This matches the parent size reading; to move by pixels, put the control in a [1, 1] frame. {measured, code (source)} (Source: BC-S6, BC-S12, BW-doc, VN hud_screen.json:319, CN, CPR, 2026-11-18 Windows 1.26.65.1)
  • [LAY-11] A size binding binds both axes. If only one axis is bound, the other axis becomes 0 and it looks as if the binding failed. An unbound axis keeps its declared value (Cinnabar reconstruction), so if the declaration is [0, 0] that axis stays 0. {measured, code (source)} (Source: BC-S12, CN)
  • [LAY-12] What can be bound where depends on where the control was created. A size binding on a static control did not need use_anchored_offset (Windows 1.26.65.1 measurement). {measured} (Source: BC-S12, BW-doc, 2026-11-18 Windows 1.26.65.1)
PropertyStatic controlA cell created by a computed length factoryA cell of the engine form_buttons factory
#size_binding_x/yworksdoes not workworks
#anchored_offset_value_x/y (+ use_anchored_offset: true)works only with a corner anchor (a multiple of the parent size, measured on Windows 1.26.65.1, LAY-49)does not workworks
"alpha": "#alpha"the float as is (LAY-13)-the float as is in the code, not measured in game (LAY-13)
visible, text, #collection_lengthworksworksworks
  • [LAY-13] A bound alpha applies as the float it is. On Windows 1.26.65.1, a white image over a black image with "alpha": "#alpha" and 0.5 from property_bag passed through a view binding had a center pixel of (128,128,128), and a static "alpha": 0.5 was also (128,128,128). .2, .5 and .9 also each drew with a different transparency. In the code #alpha is read as a float and stored without clamping. Integers and floats give their value, booleans give 1.0 and 0.0, and strings (including numeric strings), arrays, objects and a missing key give 1.0. With only the view binding target set to #alpha and no declaration, even the integer 1 was invisible (measurement record). An expression of constants only ((1 * .5)) has no # property, so the binding is dropped and alpha stayed 1; pass the value through a # property (BND-05). {measured, code (source), code (binary)} (Source: BC-S12, CN, 2026-11-19 Windows 1.26.65.1, 2026-11-24 Windows 1.26.65.1 measurement and decompilation)
  • [LAY-14] The combination of a size binding + use_anchored_offset + a collection cell crashed the client twice on a chest screen. Avoid this combination. {measured} (Source: BC-S6)
  • [LAY-15] When the size binding value changes while the screen is open, layout is redone. In the code, when a #size_binding_* value changes the size expression, the size node is marked dirty and recomputed; if the expression is the same, nothing happens. This was not measured in game. {code (binary)} (Source: BC-S6, BC chapter 8, 2026-11-24 Windows 1.26.65.1 decompilation)

Anchors and offsets​

  • [LAY-16] anchor_from is the parent's reference point and anchor_to is its own reference point. The values are 9: top_left, top_middle, top_right, left_middle, center, right_middle, bottom_left, bottom_middle and bottom_right. {vanilla} (Source: VN all 9 used, value dictionary)
  • [LAY-17] offset is movement relative to the anchor and uses the same units as size (pixels, %, expressions). Example: "offset": [0, "50%-68px"]. The axis is not flipped even for right and bottom anchors: in the distribution over 206 vanilla files, the x of right anchors is negative 104 to positive 37 and the y of bottom anchors is negative 190 to positive 45, and common.close_button uses [-2, 2] with a top_right anchor (ui_common.json:3239-3246). {vanilla} (Source: VN hud_screen.json:2146, ui_common.json:3239-3246)
  • [LAY-43] An anchor value is read only when it equals one of the 9 names (LAY-16) exactly, including case; any other string is center. On Windows 1.26.65.1, left, top, middle_left and Top_Left all landed at the center. The Cinnabar reconstruction, which decides by whether the name contains left, right, top or bottom, differs from the game. {code (source), code (binary), measured} (Source: NB, CN, 2026-11-20 Windows 1.26.65.1)
  • [LAY-60] An omitted anchor_to is center. A control given only anchor_from: "bottom_right" had its own center on the parent's bottom right point. To attach a corner, write anchor_to with the same name too (LAY-45). {code (binary), measured} (Source: NB, 2026-11-20 Windows 1.26.65.1)
  • [LAY-38] Children of a stack panel ignore offset, and ignore anchors too unless use_child_anchors: true. The main axis size of an omitted stack panel is 100%c. {code (source)} (Source: CN test S04, CN)
  • [LAY-56] The offset given to stack_panel children did not move the position the stack decided. When 48 cells were put in a horizontal stack and folded per row with offset, they ran in one line out of the window. For 2D layout, put horizontal stack rows inside a vertical stack. {measured} (Source: FFR)

Layers and draw order​

  • [LAY-18] layer is a relative value to the parent. To know which of two overlapping controls is in front, you must compare the layers of the whole ancestor chain. In the code the absolute layer is the parent's absolute layer + its own value (integer). {measured, code (binary)} (Source: BC-rules, 2026-11-24 Windows 1.26.65.1 decompilation)
  • [LAY-19] There is a measurement record that for siblings on the same layer, array order does not guarantee draw order. In the code, draw items are stable-sorted by absolute layer in ascending order, and equal values keep tree preorder (array order). So siblings with the same absolute layer are predicted to draw in array order, with the later sibling on top. The measurement that looked unordered may have had different ancestor layer sums (inferred). The order of siblings with the same absolute layer was not measured separately in game, so if front and back matter, give different layers. {measured, code (binary)} (Source: BC-rules, MJ 4.2-10, 2026-11-24 Windows 1.26.65.1 decompilation)
  • [LAY-20] If the same data must be drawn in the order "all outlines, then all lines, then all nodes, then hover", raising layers within one item is not enough (the next item's outline covers the previous item). Draw the same collection several times with factories on different layers. {working pack} (Source: BA chapter 5)
  • [LAY-21] Layers of 50 or more are common in vanilla too. A warning that the layer is high can be ignored. The 2026-11-24 decompilation found no code for a layer limit or a warning, and the layer was used as the integer sum. {vanilla, inferred} (Source: MJ chapter 5, 2026-11-24 Windows 1.26.65.1 decompilation)
  • [LAY-33] alpha makes only that control transparent and is not propagated to children. To make children transparent too, give propagate_alpha: true (BND-15). layer may be negative and then draws below the parent. The code agrees. {code (binary), vanilla} (Source: BW-doc Control table, 2026-11-24 Windows 1.26.65.1 decompilation)
  • [LAY-67] layer is read only as an integer. Writing it as a string such as "layer": "5" gives layer 0. {code (binary), measured} (Source: NB, 2026-11-20 Windows 1.26.65.1)
  • [LAY-55] When the label of a cell created by a factory or grid inside a scroll area was put on the same layer as the background image (default 0), icons and progress bars showed immediately but text was empty until something touched it (sometimes only the touched cell appeared). Putting the label on a layer higher than the background (icon 2, label 3) made everything visible as soon as it opened. Vanilla button labels are also layer: 2. binding_condition, having an expression or not, having a factory or not, clipping and scroll refresh had nothing to do with this symptom. {measured} (Source: FFR)
  • [LAY-58] When a label and the fill under it have the same ancestor layer sum, the fill can cover the label. In the chest screen gallery the PlayerList names (sum 14), the Badge counts (sum 38) and the NumberInput value did not show, and each sat on a fill with the same layer sum. Raising the label layer made them show. Whether an equal sum always covers was not tested on its own (inference). Give text a larger sum than its fill. The setup is in Building basic components with InvUI. {measured} (Source: IUC)

Clipping and overlays​

  • [LAY-22] clips_children: true clips children to its own area. Giving a child allow_clipping: false draws it outside the ancestor's clipping (a tooltip that goes out of a scroll area). {vanilla, working pack} (Source: VN clips_children 27 uses and allow_clipping 7 uses, BA chapter 5, AP 4.8)
  • [LAY-23] To darken the surroundings when a tooltip shows, put a very large translucent black image (BA 4000x4000 alpha 0.3, AP 500x500 alpha 0.225) behind the tooltip and give it allow_clipping: false. {working pack} (Source: BA chapter 5, AP 4.8)
  • [LAY-24] If you need a background fitted to the text width, grow the parent to "100%c"/"100%cm" with a measuring label of alpha: 0, and draw the visible label separately on top. {working pack} (Source: BA chapter 5)
  • [LAY-68] An omitted allow_clipping inherits the parent's value (true without a parent). So a control with allow_clipping: false draws outside the parent's clips_children, and its children, unless they set it themselves, drew outside too. The code follows an explicit value, so to clip a descendant again, write allow_clipping: true on that descendant (LAY-22). {code (binary), measured} (Source: NB, 2026-11-20 Windows 1.26.65.1)

Grids​

  • [LAY-25] A grid is made with grid_dimensions (fixed size) or grid_dimension_binding (bound size), grid_item_template and maximum_grid_items. {vanilla} (Source: VN by property key 37, 79, 117 and 11 uses)
  • [LAY-26] grid_fill_direction uses only vertical in vanilla. Values like left_to_right have no basis. grid_rescaling_type uses only horizontal (21) and vertical (1) in vanilla and does not use none of the official enum. Of the 3 values of grid_fill_direction the wiki lists (vertical, horizontal, none), only vertical has vanilla evidence. grid_rescaling_type: "vertical" has a crash warning (LAY-32). On a collection grid reading chest slots (grid_dimensions: [3, 2], maximum_grid_items: 6), horizontal drew only the three cells of the top row and vertical drew only the first cell and one cell outside the right edge of the grid. It cannot be used for column-first filling. {vanilla, measured} (Source: VN, MJ 4.2-3 and 4, BW-doc, BW-dyn, CPR)
  • [LAY-29] To place a static child directly in a grid cell, give the child "grid_position": [column, row] (from 0). In a grid_dimensions [4, 2] grid, [3, 0] landed at the top right and [0, 1] at the bottom left (measured, mobile, 2026-11-16). Vanilla also uses it 71 times, and it is also used to overwrite a specific cell of an engine-made grid. {vanilla, measured} (Source: VN, HXC, BW-dyn screenshot)
  • [LAY-30] For a grid whose count is decided by a binding, give grid_rescaling_type: "horizontal" and a fixed width and set the count with #maximum_grid_items (or maximum_grid_items). The column count is floor(grid width / template width) (160px / 32px = 5 columns, count 15 gives 3 rows). Set the height to "100%c". {measured} (Source: BW-dyn screenshot)
  • [LAY-31] A grid gives space to hidden (visible false) items too. This is the opposite of a stack panel (LAY-04), so putting conditional items in a grid leaves empty cells. Make lists that must collapse with a stack panel. In the Cinnabar reconstruction too, grid cell positions are decided by index, so hidden cells take up space. Measured on Windows 1.26.65.1, hiding item 1 of a grid [4,1] left items 2 and 3 at x 40 and 60, and the same items in a horizontal stack panel pulled item 2 to x 20 (claim measurements). {code (source), measured} (Source: BW-dyn "Useful Information", CN, 2026-11-18 Windows 1.26.65.1)
  • [LAY-32] There is a warning that grid_rescaling_type: "vertical" can crash the game. Vanilla uses it once (store_item_list_screen.json). When making something new, use horizontal. In the 2026-11-24 decompilation, vertical rescaling was the formula rows = max(1, floor(height / cell height)), and no path leading to a crash was found. {unverified, vanilla} (Source: BW-dyn, VN, 2026-11-24 Windows 1.26.65.1 decompilation)
  • [LAY-41] A grid cell ignores its own anchor and offset. A template grid fills cells in row-first creation order and does not create cells beyond capacity. In game, the cells of a 100-wide grid with grid_dimensions: [5, 1] were 20px, and a 12px template stuck to the top left of its cell, leaving 8px between the last item and the right edge. A template size of ["100%", "100%"] resolved to the whole grid size, so items stacked one per row downward and overflowed the grid. To spread items evenly, use a fixed template the size of a cell (here [20, 14]) and anchor the item to its center. {code (source), measured} (Source: CN tests D01 and D08, CPR)

Vanilla uses of the [column, row] order of LAY-29 grid_position: inventory_screen.json:1200 (in the 3x3 crafting cells, crafting_input_item_top_mid is [1, 0] and mid_left is [0, 1]), trade_screen.json:327 (the children of the [4, 1] grid are [0, 0] to [3, 0]) and inventory_screen.json:1054 (the children of the armor [1, 4] grid are [0, 0] to [0, 3]).

9-slice and tiles​

  • [LAY-27] For 9-slice, put a .json of the same name next to the texture file and write nineslice_size ([left, top, right, bottom] or one value) and base_size. Vanilla UI JSON does not use nineslice_size as a literal property and uses it once through a binding (#banner_nineslice_size to #nineslice_size). {working pack, vanilla} (Source: BA chapter 5, AP 4.9, VN start_screen.json:1639)
  • [LAY-28] For a repeating background, give the image "tiled": true. {vanilla, working pack} (Source: VN 44 uses, AP 4.9, BA chapter 5)

Scrolling​

  • [LAY-42] A scroll view searches for the role controls (viewport, content, track, box, bar panel) breadth-first by name, so their position in the tree is free, but if any one of the four is missing it does not scroll. The box length is ceil(track length x viewport / content). On Windows 1.26.65.1, a scroll with content 5161 and viewport 666 had an 84 px box, matching this formula. Cinnabar keeps the box at 10% of the track or more, but this measurement had a ratio of about 13%, so it did not test that minimum. The Windows 1.26.65.1 code confirms the minimum of 0.1. "If any one of the four is missing it does not scroll" was confirmed in the code only for a missing box (the scroll axis comes from the box's draggable). The bar panel hides when the content fits. {code (source), code (binary), measured} (Source: CN tests V02, V07 and V06, 2026-11-20 Windows 1.26.65.1, 2026-11-24 Windows 1.26.65.1 decompilation)
  • [LAY-57] A scroll area covering the whole screen (common.scrolling_panel) took over touches of that area even when its content was empty. When it was always placed in $screen_content, the vanilla buttons and close button of other forms could not be pressed and only scrolling worked. Create or show a scroll area only in the form that uses it. {measured} (Source: FFR)
  • [LAY-71] The distance a scroll view moves for one mouse wheel step is a constant independent of the view size. In the code, a scroll view that gets a wheel event clamps new position = current position + (-scroll_speed x y) to [0, content - viewport] and moves there at once without animation, and the place that creates this event has no term that multiplies by the view size. scroll_speed is stored only once in a static variable of the function, so the value of the first scroll view that gets a wheel event is used for every scroll view after that. y looks like the screen's vertical_scroll_delta (20 if not a number, truncated to an integer), so one step = scroll_speed x vertical_scroll_delta was inferred. The vanilla common.scrolling_panel scroll_speed of 15 (ui_common.json:4435) times the default 20 gives 300, which matches the figure "about 300 px" whose measurement conditions are not recorded. It does not match the Windows 1.26.65.1 measurement: in the vanilla chat messages_scrolling_panel (content 5646 px, viewport 810 px, GUI scale 4) one wheel step moved the content by 56 to 57 client px (about 14 GUI), and one step down was -56. So the 15 x 20 = 300 inference is not supported by this measurement, and the unit of the step value (14 GUI, or 15 with another scale applied) is unknown. After merging vertical_scroll_delta: 40 into the screen chat_screen and reopening it, the step distance was the same, but whether the merge reached the actual screen control was not confirmed (no related log line). The call path from wheel input to this event was not found. {measured, code (binary), inferred} (Source: 2026-11-24 Windows 1.26.65.1 decompilation, VN ui_common.json:4435, 2026-11-25 Windows 1.26.65.1)
Proposed rules

The rules below lack evidence or are not adopted yet. Check the evidence before using them.

  • [LAY-44] (proposal) Use only + and - in size and position expressions. The 551 kinds of vanilla size strings (12,806 uses, 12,712 when counted by element) never have * or /, and Mojang does ratio calculations in a comment and then writes the resulting coefficient ("34.628%x + 2px" in store_common.json:5870, a comment in store_search_screen.json:64). Decimal coefficients (56.25%x, 1.1249px) and negative terms ("-50% + 10px") are used. Not checked: whether using * in a size expression ("50% * 2") is ignored or an error. {vanilla} (Source: UIS, bedrock-samples)
  • [LAY-45] (proposal) Write anchor_from and anchor_to together. Vanilla writes both in 2,985 of 2,997 places (99.6%), and in 106 of those they differ from each other (12 places write only one, 6 each). An omitted side is center (LAY-60, measured on Windows 1.26.65.1). The center assumption of JsonForge and Cinnabar matches the game, and the w1zardz editor's assumption that anchor_to equals anchor_from differs from the game. {vanilla, code (source), measured} (Source: JF, WZ, CN, bedrock-samples, 2026-11-20 Windows 1.26.65.1)
  • [LAY-46] (proposal) Do not give a child inside a "100%c" parent a % size on the same axis. In the vanilla tally this setup appears in 0 of 1,972 places. A comment by the editor (JsonForge) author says the child size decides the parent and the parent size decides the child, making a cycle where nothing is drawn. There is no engine code evidence. On Windows 1.26.65.1, the parent width and the "50%" child width became 0, but a fixed-size sibling (40x10) was still drawn. So "nothing is drawn" does not hold for fixed-size children (claim measurements). Give children of a content panel pixels or default. {vanilla, measured, unverified} (Source: JF, bedrock-samples)
  • [LAY-47] (proposal) The UI pixel size of a screen is not a fixed value. It varies with window size and GUI scale, and visual editors also assume different values (w1zardz 427x240, 520x240, 320x240, JsonForge 384x216). Fixed px are drawn multiplied by an integer scale, and vanilla layouts assume minimum virtual screens of pocket 320x210 and desktop 376x250 (comments at ui_common.json:6380 and 6430). If you keep the top-level window within this size it is not cut off at any resolution. Elements attached to the screen edge are placed with the corresponding corner anchor and a small pixel offset. The scale system changed in 1.26.0 (the minimum scale is half the maximum, and handheld devices are DPI based, MS Learn Update1.26.0). Not checked: the scale calculation in 1.26.50. {vanilla, unverified} (Source: NE, ms-learn, WZ, JF)
  • [LAY-48] (proposal) common.scrolling_panel creates only one of the scroll_touch (touch) and scroll_mouse (mouse) subtrees depending on $touch (ui_common.json:4718-4750). The path to the scroll content and the size variables (the _touch pair) differ per input mode, so when pointing inside a scroll with path keys or source_control_name, consider both paths or pin one side by passing "$touch": true to the instance (resource_packs_screen.json:2685 does the same). {vanilla} (Source: NE, bedrock-samples)
  • [LAY-49] (proposal) #anchored_offset_value_x/y pushes in the anchor direction by value times the parent size on a control with use_anchored_offset: true. It has no effect if anchor_from is center. To use it on a static control, give a corner or edge anchor. On Windows 1.26.65.1, a static panel in a 100-wide parent moved x by 1000 with top_left and 10, and by 10 with bottom_left and .1. center and no use_anchored_offset did not move it (claim measurements). A name with the _absolute suffix had no effect. Not checked: edge anchors. {code (source), measured} (Source: CN, LG, BC, 2026-11-18 Windows 1.26.65.1)
  • [LAY-50] (proposal) When drawing an engine collection grid (hotbar_items, etc.) in another shape, copy the vanilla definition while removing the grid_dimension_binding property itself and fixing grid_dimensions. Just emptying bindings makes the dimension binding automatically reattach in the Cinnabar model. Conflict C-62. {code (source), unverified, conflict} (Source: CN, LG, bedrock-samples)
  • Vanilla does not use wrap_content. Vanilla binds #priority 3 times (store_common.json:732, 8239, 8503) with a parent stack set to use_priority: true (LAY-40). {vanilla}

Facts added by community reports (community)​

(Source: private research) All are at the report level.

  • The type of a text control is label, not text. The anchor value is left_middle, not middle_left (LAY-16).
  • The "default" size differs by type: a panel 100%, a label the text size, a stack panel ["100%","100%c"], a grid ["100%c","100%c"] (the same as LAY-03 and LAY-38). There is a report that the unitless string "10" gives a Dangling number error, and Cinnabar reads it as 0 (LAY-34). In the Windows 1.26.65.1 code both hold: it logs and drops the number, giving 0 (2026-11-24 decompilation).
  • Hidden grid items take up space (LAY-31, Windows 1.26.65.1 measurement). Buttons that will always be hidden (tab, back) go at the end of the collection (COL-35).
  • For bottom alignment inside a stack panel, put a ["100%","fill"] panel as the first child so it eats the remaining space.
  • If you need a moving position, use use_anchored_offset: true and #anchored_offset_value_x/y (a ratio against the parent size). Measured on Windows 1.26.65.1, the value on a static panel moved it by a multiple of the parent size and did not move it with a center anchor (LAY-49). A fixed-size parent and a top-left anchor are the most stable. A view binding that copies a property bag key holding an array to #offset also moves the control (LAY-05).
  • #size_binding_x/y is a ratio against the parent (2.5 is 250%), and pixels are _absolute (LAY-10). Measured on Windows 1.26.65.1, .5 gave half the parent width, 2 gave twice, and #size_binding_x_absolute 20 gave 20 (measurement record). There is a report that the value must be a number and a wrong value crashes. #anchored_offset_value_x_absolute (top_left, value 10) had no effect on Windows 1.26.65.1, so it is not used.
  • A bound #alpha applies as the float it is: a bound 0.5 on an image with "alpha": "#alpha" was the same translucency as a static 0.5 (LAY-13, Windows 1.26.65.1 measurement).
  • The grid property name is grid_dimensions (grid_dimension gives a type error). Subpixel gaps sometimes appear in windowed mode. The GUI scale can neither be read nor ignored, so use % rather than fixed pixels.
  • Scrolling: use the variables of common.scrolling_panel, $scrolling_pane_size applies only when specified in size, and hiding the scrollbar is "$scroll_bar_and_track_size": [0,0] (LAY-02, LAY-42).
  • Phones draw the UI large, so the screen height is small at about 200px. Keep a server form window at fixed pixels and handle overflowing content with inner scrolling (LAY-53, LAY-54).
IDTopicClaim and evidenceVerdict
C-43A binding expression without #Measurement discards the whole bindings array, Cinnabar only that one bindingOpen: follow BND-05
C-62A grid that left grid_dimension_bindingLAY-50 aboveOpen

Items that need measurement​

  • Relayout of a size binding on an open screen (LAY-15). The code recomputes it.- Whether, when two siblings with the same absolute layer overlap, the later sibling is always drawn on top (LAY-19).
  • Whether a control with both inherit_max_sibling_width and max_size goes past the maximum, and the result when two siblings both turn it on (LAY-69).
  • Whether a screen with screen_not_flushable: true closes when switching to another screen on top of it (LAY-70).
  • The wheel step of a scroll view with scroll_speed 1 (predicted 20), whether it doubles with a screen vertical_scroll_delta: 40, and whether, with two scroll views on one screen given different scroll_speed, the value of the one that first got a wheel event is used by the other too (LAY-71). One step of the vanilla chat was about 56.5 client px (about 14 GUI at scale 4), which does not match 15 x 20 = 300. vertical_scroll_delta: 40 merged into chat_screen changed nothing, but whether the merge applied is unknown, so measure again by overriding the whole screen definition or by placing a scroll view directly on a probe screen (Windows 1.26.65.1 measurement, 2026-11-25).
  • The relation between the window size at which a [376, 250] panel starts to be cut off and the GUI scale (LAY-47).
  • Whether the scroll box has a minimum when the viewport is less than 10% of the content (LAY-42).
Sources
idSourceLicenseCommitAccessed
repo-guideJSON UI comprehensive guide (this repository) (guide/)This project's material2026-11-13
repo-surveyJSON UI material survey (this repository) (survey/)This project's material2026-11-13
private-researchPrivate research (-)-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
bedrock-samplesMojang bedrock-samplesMinecraft EULA applies, (c) Mojang AB. All rights reserved15701fa9 (guide baseline 46ba6ea)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
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
mcbejsonuimasteraimcbejsonuimasterAINo LICENSE at the repository root (NOTICE.md contains only third-party MIT notices). Facts only, rewritten527276c2026-11-13
netease-docsNetEase developer documentation, UI chapter (mirror EaseCation/netease-modsdk-wiki)No LICENSE in the mirror repository, the original is NetEase's work. Facts only, rewritten6dd12332026-11-13
repo-tool-analysesJSON UI tool analysis (this repository) (jsonui-lsp/, jsonui-schemas/, jsonforge/, easyuibuilder/, jsonencryptor/, bedrock-json-ui-editor/)This project's material2026-11-13
jsonforgeJsonForgeMIT (Copyright (c) 2026 JsonForge)28748762026-11-13
bedrock-json-ui-editorbedrock-json-ui-editor (w1zardz)MIT is stated only in the README, no LICENSE file1f18f0d (tools research), 9cb4896 (cases research)2026-11-13
json-ui-examplesjson-ui-examplesMIT (confirmed in the repository LICENSE, Copyright 2025 LeGend)d4ff5002026-11-13