Skip to content

Shared Properties

Quetzy edited this page Jun 20, 2022 · 9 revisions

[!] Needs Update for 0.3.0 [!]

All elements have some shared properties:

Property Type Default Value Bindable? Required? Description
type string - no Required The type property is what tells YUI what kind of element is being defined by the rest of the properties. The type value must either be a built in YUI type, or the name of an available fragment or template resource.
id string An automatically generated ID identifying the element's place in the render tree no A unique ID for this element, which must be completely unique per screen.
item_key {binding} undefined yes TODO
visible boolean false yes Controls whether an element is visible. An element that is not visible will not be rendered (and will not take up any layout space). Generally, you will use data binding to control element visibility based on game data in some way.
size auto, content, or {size definition} auto no size determines how the element takes up space within the overall layout.
data_source Data Binding - yes The data_source property allows you to change the data context for an element and its children. See Data Binding for more details.
tooltip string or YUI element - yes Every element can display a tooltip when the cursor is placed over the element. The value can be a string, which will be converted to a text element, or another element (which could be a panel with more content!)
tooltip_width number 500 no The maximum width of the tooltip. If text is wider than this value, it will be wrapped
tooltip_placement tooltip_placement bottom_left yes Controls where the tooltip is placed relative to the current element.
events {events definition} - See Events The events property is where you define handlers for the events supported by each element. Check the Events section in the element's wiki page.
cursor_events auto, none, or consume_all auto no TODO
interactions {interactions definition} - See Interactions The 'interactions' property defines which interactions an element participates in, and which role(s) it supports for that interaction. See Interactions for more details.

Debug Properties

Some shared properties are available to help with debugging:

Property Type Default Value Bindable? Required? Description
trace boolean false no The trace property can be useful for debugging. When set to true, some elements will draw a colored border to indicate what size they're taking up, and various breakpoints in the code can be set in order to identify what is happening when an element is being rendered.