-
Notifications
You must be signed in to change notification settings - Fork 8
Authoring Layouts ItemGrid
An item grid is a regular grid of tracked items declared row-by-row, with shared item sizing and margins. It's the workhorse element for the main items area of nearly every pack — when you want N rows of M items, all the same size, this is the right tool.
See Authoring Layouts for the file format and base fields. This page only covers fields specific to the
itemgridtype.
Parsed in EmoTracker.Data/Layout/ItemGrid.cs, which delegates to EmoTracker.Data/Items/ItemGrid.cs:Load. Matches the itemgrid branch in layouts.json.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
type |
"itemgrid" |
yes | — | Literal string. |
rows |
array of arrays of strings | yes | — | Each entry is a row; each string in a row is an item code. Use empty strings or Blank item codes for grid spacers. |
item_size |
number | no | 32 |
Pixel size used for both item width and height. |
item_width |
number | no | item_size |
Overrides item width. |
item_height |
number | no | item_size |
Overrides item height. |
item_margin |
string | no | "5" |
Margin around each item — uses the same 1/2/4-number comma syntax as the base margin field. |
badge_font_size |
number | no | 12 |
Font size used for item badges (e.g. consumable counters). |
Plus the standard base fields from Authoring Layouts → Fields every layout element shares.
Legacy
marginfield. Older packs used the basemarginfield onitemgridto mean "margin between items" rather than "outer margin around the grid". The runtime preserves that behavior for packs declared with an olderLayoutEngineVersion. New packs should useitem_margin(clear meaning) and reserve the basemarginfor outer spacing.
Each entry in rows is parsed via ItemDatabase.FindProvidingItemForCode for every code in the row. The grid renders rows top-to-bottom and items left-to-right within each row. Rows can have different lengths — the layout doesn't enforce equal column counts, so a 3-item row sits next to a 5-item row without padding (you can pad manually with Blank items).
{
"type": "itemgrid",
"item_size": 32,
"item_margin": "3",
"rows": [
[ "sword", "shield", "bow", "boomerang" ],
[ "hookshot", "lamp", "hammer", "shovel" ],
[ "fluteact", "bugnet", "book", "bottle" ]
]
}When you need different sizes within the same visual area, use multiple grids inside an Array:
{
"type": "array",
"orientation": "vertical",
"content": [
{
"type": "itemgrid",
"item_size": 32,
"rows": [ [ "sword", "shield", "bow" ] ]
},
{
"type": "itemgrid",
"item_size": 24,
"rows": [
[ "ep_prize", "dp_prize", "th_prize", "pd_prize" ]
]
}
]
}If a row has fewer items than the others and you want it visually centered or padded, use a Blank item code in the gap, or just include "":
{
"type": "itemgrid",
"rows": [
[ "sword", "shield", "bow" ],
[ "blank_a", "hookshot", "" ]
]
}-
Codes must resolve to existing items. Empty / unknown codes leave the cell empty in the grid. Use
Tracker:AddItems(...)for all relevant items before loading the layout that references them. -
item_sizeis the simplest knob. Set justitem_sizefor a uniform grid; useitem_width/item_heightonly when you need non-square items. - For irregular layouts (mixed sizes, gaps, overlapping), prefer Array or Canvas. Item Grid only handles regular grids.
- Different rows can have different lengths. The grid doesn't pad short rows automatically; explicit blanks are the standard way to align them visually.
-
badge_font_sizecontrols counter text size — bump it up for consumables with multi-digit counts.
- Authoring Layouts — top-level format and base fields
- Authoring Layouts — Item — a single item by itself
- Authoring Items — how items are declared
- Authoring Items — Blank — placeholder items used for grid spacing
-
layouts.jsonschema — authoritative JSON schema
- Installation
- Installing and Loading Packages
- Item Types and Mouse Controls
- Map Locations
- Map Location Colors
- Saving and Loading
- Multi-Tab and Window
- Autotracking
- NDI Broadcasting
- Twitch Chat HUD
- Note Taking
- Voice Control
- Keyboard Shortcuts