Panels, buttons and labels are UI items for the custom tabs of a template. A panel holds fields and other UI items and lays them out stacked or on a grid of its own. A button calls the template script with a click name. A label shows a heading or a text. They are added in edit layout mode, like HTML fragments and HTML panels. See Template Layout for custom tabs and edit layout mode.

Panels, buttons and labels are available from Template Builder 3.8. Panels require Pilot Edge 3.8 or later: earlier versions show the text This element is not supported, please update the client. in place of a panel. Buttons and labels are HTML fragments, see Inline HTML Fragment.

Add a panel, button or label

  1. Open the template and select a custom tab. On the auto-generated All tab the buttons are disabled, with the tooltip UI panels can only be added to custom views.

  2. To add the item inside a panel, select the panel. To add it to the tab, click an empty area of the tab to clear the selection.

  3. Click Label, Button or Panel on the toolbar beside the form. The tooltip shows where the item goes: Add Panel to current view, or Add Panel to panel "details" when the panel details is selected.

  4. In the Create new ui panel dialog, enter the Name of panel and click OK. The name can only contain letters and digits, and must be unique within the tab, including the items inside panels. The suggested name is the item type (label, button or panel), with a number added when the name is taken.

  5. The item is added after the existing items of the tab or panel. Edit layout mode is turned on, the new item is selected, and its settings are shown in the properties pane.

image-20261109-143505.png

The new item stays selected. When it is a panel, the next item you add goes into that panel.

On a grid tab, a new label or button is 4 columns wide and 4 rows high, and a new panel is 12 columns wide and 15 rows high. New items are placed in the first column, below the existing items. In a grid panel, the width is limited to the columns of the panel. A row is the Grid size of the style, 8 px in the built-in style (see Styling).

Panels

A panel holds fields, buttons, labels, HTML fragments, HTML panels and other panels. The panel lays out its items, stacked or on a grid. Panels are only shown on custom tabs.

Panel settings

Select the panel to show its settings in the properties pane.

image-20261109-143615.png

Setting

Values

Description

Hidden expression

A JavaScript expression

Hides the panel and all items in it while the expression is true. See Hide items.

Layout

stacked (default), grid

How the panel lays out its items. See Stacked layout and Grid layout.

Orientation

vertical (default), horizontal

The direction of the items. Stacked layout only.

Columns

1–12 (default 12)

The number of columns the width of the panel is divided into. Grid layout only.

Padding

unset, small, medium, large

The space between the edge of the panel and its items, relative to the Grid size of the style: unset is none, small a quarter, medium half, and large the full grid size. With the built-in style: 0, 2, 4 and 8 px. New panels use medium.

Background

default, transparent, custom

default: a 5% black or white tint, whichever contrasts with the Canvas color of the style. transparent: no background; what is behind the panel shows through. custom: the color set in Background Color.

Background Color

A color

The background color of the panel. Shown when Background is custom. Without a color, the default background is used.

The items in a panel keep the colors of the style of the form. With a custom background color, check that the text color of the style contrasts with it.

Stacked layout

  • vertical: the items are placed one below the other.

  • horizontal: the items are placed side by side and share the width of the panel equally. Each item is at least 150 px wide; items that do not fit wrap to a new row.

Items in a stacked panel have no position or size of their own. Their order is set in the component tree, see Move items into and out of panels.

Grid layout

A grid panel works like a grid tab with its own columns:

  • The width of the panel is divided into the number of Columns. Rows have the height of the Grid size of the style, and the gap between columns is the grid size.

  • In edit layout mode, move an item by dragging it and resize it by dragging its edges. Items snap to the columns and rows of the panel. The grid of the panel is shown while one of its items is selected.

  • Items are kept within the columns of the panel and below its top. An item moved below the bottom of the panel extends its content: the panel keeps its size and scrolls.

Changing Layout rearranges the items:

  • From stacked to grid: each item gets its default size and is placed in the first column, one below the other, within the columns of the panel.

  • From grid to stacked: the positions and sizes of the items are removed.

Move items into and out of panels

  • New items: select the panel before you add the item, see Add a panel, button or label.

  • Fields: drag a field from the field tree onto the panel. In a stacked panel, a line marks where the field is inserted. In a grid panel, the field snaps to the cell under the pointer.

  • Items already on the tab: use the component tree. Click Toggle component tree at the right end of the tab row. The tree lists the items of the current tab, with the items of each panel under the panel. Drag an item onto a panel to move it in, or out of the panel to move it out. The order in the tree is the order of the items. An item moved into a grid tab or a grid panel gets its default size and is placed below the other items.

On the form, dragging an item moves it within its own tab or panel only.

Panels can contain panels, to any depth. A field can be placed once per tab, either at the top level or in one panel: Add field to view is disabled for a field that is already on the tab, also when it is inside a panel.

Removing a panel from the tab also removes the items in it. The fields stay in the model.

Buttons

A button calls the vizrt.onClick handler of the template script with its click name. Buttons use the font, the text color and the corner rounding of the style (Corner radius, see Styling). A new button fills the area of its item.

Setting

Values

Description

Hidden expression

A JavaScript expression

Hides the button while the expression is true.

Button Text

Text (default Click me)

The text on the button.

Click Name

Text (default something)

The name passed to vizrt.onClick. Stored in the vizrt-click-name attribute of the button.

To act on a click:

  1. Add a button and set Click Name, for example reset.

  2. In the template script, assign vizrt.onClick and check the name:

    vizrt.onClick = (name: string) => {
    if (name === "reset") {
    vizrt.fields.$headline.value = ""
    }
    }

Labels

A label shows a heading or a text in the font and text color of the style.

Setting

Values

Description

Hidden expression

A JavaScript expression

Hides the label while the expression is true.

Label Type

Header 3, Header 4, Label (default)

The element of the label: h3, h4 or span.

Label Text

Multi-line text (default Label)

The text of the label. Line breaks are kept.

Simple editor and advanced editor

Buttons and labels are HTML fragments. Their settings are under HTML Mark-up fragment in the properties pane, with a toggle between Simple editor and Advanced editor:

  • Simple editor shows Button Text and Click Name, or Label Type and Label Text. Other attributes of the element, such as style and class, are kept.

  • Advanced editor shows the HTML mark-up. The rules for HTML fragments apply, see Inline HTML Fragment.

The simple editor is available while the mark-up is one button element holding only text, or one h3, h4 or span element holding only text. When the mark-up no longer fits, for example after adding a child element, the toggle is removed and the item is edited as HTML. An HTML fragment whose mark-up fits also gets the simple editor.

image-20261109-144400.png

Hide items

Panels, buttons and labels have a Hidden expression. The item is hidden while the JavaScript expression is true, for example {{field1}}=="HIDE". A hidden panel hides all items in it.

A script can also hide a panel, button or label that is placed at the top level of a grid tab, see Panels, buttons and labels in scripts.

Panels, buttons and labels in scripts

The items of a tab are listed in vizrt.views[n].items (see View Management in the API Reference):

  • Only the items at the top level of a grid tab are listed. For a stacked tab the list is empty.

  • A panel, button or label is listed with type "ui-item" and its name without the ui: prefix.

  • The items inside a panel are not listed. setPosition and hidden apply to the panel, and so to all items in it.

const details = vizrt.views[0].items.find(item => item.type === "ui-item" && item.name === "details")
details?.setPosition({ y: 1, height: 20 })
if (details) {
details.hidden = vizrt.fields.$showDetails.value === false
}

Lists and the All tab

  • Panels are not shown on the auto-generated All tab. The fields placed in panels are shown there as usual.

  • Panels cannot be placed in the rows of a list. A list field can be placed in a panel.

How the items are stored in the model

Each item is a UI item of the tab, named ui: followed by the name entered when it was added, for example ui:details.

Item

Stored as

Button

An HTML fragment (pane type text/vnd.vizrt.vdf-html) holding one button element. The click name is in the vizrt-click-name attribute.

Label

An HTML fragment (pane type text/vnd.vizrt.vdf-html) holding one span, h3 or h4 element.

Panel

A UI item with pane type text/vnd.vizrt.vdf-html, whose content is the text shown by clients without panel support. The settings and items of the panel are in a panel extension element in the http://www.vizrt.com/2011/bgfx namespace.

The mark-up of a new button and a new label:

<button vizrt-click-name="something" style="width: 100%; height: 100%; min-width: 24px; min-height: 24px;">Click me</button>
<span style="width: 100%; height: 100%; min-width: 24px; white-space: pre-line;">Label</span>

The panel extension element has these attributes, and a view holding the items of the panel with its layout, stacked or grid. An attribute is left out when the setting has its default value.

Attribute

Values

Description

orientation

vertical, horizontal

Orientation. Stacked panels only.

padding

small, medium, large

Padding. Left out for unset.

columns

1–11

Columns. Grid panels only; left out for 12 columns.

backgroundColor

A color, for example #1e3a5f, or transparent

Background and Background Color. Left out for default.