Skip to main content

Card template

File: assets/<namespace>/cards/<path>.json, loaded from the client resource pack. For example, assets/system/cards/shop_catalog.json overrides the shop catalog layout. The server sends the business snapshot, and the client creates cards from the CardBuilder template and parameters; changing a template does not change prices, quest completion state or reward results.

FieldTypeRequiredDefaultDescription
styleString or string arrayno"result_card"CSS class names; an array is joined with spaces.
show_titleBooleannotrueWhether to show the main title provided by CardBuilder.
hide_summaryBooleannofalseWhether to hide the host summary.
bodyNode arrayyes—Body layout.
actionsAction display settingsnoDefault settingsSee the table below; does not create server-side business buttons.
actions.numberedBooleannotrueWhether to show numbers for existing actions.
actions.labelNode arrayno[]Action label format; an empty array uses the original labels.

Example​

assets/example/cards/result.json
{
"show_title": true,
"hide_summary": true,
"body": [
{
"type": "system:markdown",
"text": "{{summary}}"
},
{
"type": "system:flex",
"source": "{{actions}}",
"direction": "row",
"children": [
{
"type": "system:button",
"text": "{{actions.*.label}}",
"click": "{{actions.*.click_type}}",
"value": "{{actions.*.value}}",
"disabled": "{{actions.*.disabled}}",
"behavior": "{{actions.*.behavior}}"
}
]
}
]
}

Buttons come from the server snapshot or the client context. To use this template, CardBuilder must select example:result; adding only a new template file does not make existing messages switch automatically.

Plain-text convention​

When there is only one body element implementing PlainMessageNode (built in as system:text), repeat is not used, and there are no action buttons or extra title/summary content, the card can be displayed as an ordinary message. system:markdown keeps its own card layout. With buttons or other content it remains a card, and bottom controls such as notification confirmation are provided by the host code.

Templates, context and build events​

The card data implementation is responsible for creating the CardBuilder and setting the template, title, parameters and buttons; the interface, icons and callbacks are only accessed during client rendering. Extensions can add parameters in the card build event, which resource packs then use as placeholders. For the complete conventions, see Card overview, Common node fields and Editor.