Skip to content

Controls

Updated

Controls are the UI elements a player presses, drags or types into: buttons, checkboxes, switches, toggle buttons, sliders, progress bars, text inputs and the in-scene keyboard, lists, menus and tooltips. Each control reports what happened as an event through a Signal Emitter on its entity, and each has methods a script calls to change it. This page covers how to wire a control to a script, then every control with its props, methods and events.

A control sends its events only while its entity has a Signal Emitter (comp-signal-emitter). The emitter puts each event on the event bus under its signal, and a Behavior hears it with on(signal, callback).

  1. Add a Signal Emitter to the control’s entity and set its signal, for example settings:volume. A prefix such as settings: keeps your signals apart.
  2. In a Behavior, register a listener in startup: on('settings:volume', (event) => { … }).
  3. In the callback, compare event.eventType with an EventType constant and read event.data.

Every event has the shape { entityId, eventType, data }:

  • entityId is the id of the entity that sent it; findEntity(event.entityId) returns the entity.
  • eventType is '<Component>::<action>'. The EventType global names each one: EventType.UISlider.Change is 'UISlider::change'.
  • data holds the details, such as { value } or { checked }.

Several controls can share one signal; check eventType or entityId to tell them apart. An emitter’s eventFilter lets only the listed event types through. You can also add the emitter from a script: entity.addComponent(new SignalEmitterComponent({ signal: 'menu/play' })).

Event EventType Data Sent when
UIButton::press EventType.UIButton.Press {} A completed press, when the button has no Link.
UICheckbox::change EventType.UICheckbox.Change { checked } The state flips, by a press or setChecked.
UISwitch::change EventType.UISwitch.Change { checked } The state flips.
UIToggleButton::change EventType.UIToggleButton.Change { checked } The state flips.
UISlider::change EventType.UISlider.Change { value } The value changes: each step of a drag, or setValue.
UISlider::change-end EventType.UISlider.ChangeEnd { value } A drag or track press is released with a different value.
UIProgress::change EventType.UIProgress.Change { value } The shown value changes. Nothing while indeterminate.
UIInput::change EventType.UIInput.Change { text } The text changes.
UIInput::submit EventType.UIInput.Submit { text } Enter, or the keyboard’s enter key.
UIInput::focus, UIInput::blur EventType.UIInput.Focus, EventType.UIInput.Blur { text } The field gains or loses focus.
UIKeyboard::press EventType.UIKeyboard.Press { key } A key of the in-scene keyboard: the character, or backspace, space or enter.
UIKeyboard::show, UIKeyboard::hide EventType.UIKeyboard.Show, EventType.UIKeyboard.Hide {} The keyboard appears or goes.
UIList::select, UIList::deselect EventType.UIList.Select, EventType.UIList.Deselect { value } A row of the list is selected or deselected. Sent by the list entity.
UIListItem::select EventType.UIListItem.Select { value } A row is pressed. Sent by the row entity.
UIMenu::open, UIMenu::close EventType.UIMenu.Open, EventType.UIMenu.Close {} The menu popup opens or closes.
UIMenuItem::select EventType.UIMenuItem.Select { value } A menu entry is chosen.
UITooltip::show, UITooltip::hide EventType.UITooltip.Show, EventType.UITooltip.Hide {} The tooltip bubble appears or goes.

Common to all controls:

  • Editor and play. Controls are inert while you edit and react in play.
  • Disabled. A control with disabled: true is dimmed and ignores input. Disabling the component itself instead takes the control out of the layout.
  • Labels. An explicitly empty text on a UI Input, Switch, Slider, Progress or Checkbox draws no label at all.
  • Multiplayer. The state of a UI Checkbox, Switch, Toggle Button, Slider and Progress (and a UI Label) can be shared with everyone in a room as a network trait, so every player sees the same value. See Multiplayer.

The UI Button component (comp-ui-button) is a button with a label, an icon, or both. Entity: UI Button (ent-ui-button), created with the text Button.

Prop Type Default Description
text string none Button text. Empty: no caption.
icon string none An icon name, such as 'Trash2' or 'Chat', shown with the label or alone.
iconPosition 'left', 'right', 'top', 'bottom' 'left' Where the icon sits relative to the label.
variant 'solid', 'subtle', 'bare' 'solid' solid is filled; subtle shows a fill on hover only; bare is the content alone.
align 'left', 'center', 'right' 'center' Where icon and label sit in a button wider than its content.
fontSize number 16 from the theme Label size in px.
font string the theme’s Font family, by name. See Placement and fonts.
size number fontSize Icon size in px.
sizeScale number 1 Multiplies the theme’s font size and padding. Explicit fontSize and padding win.
singleLineLabel boolean false Keep the whole label on one line.
color string the theme’s foreground Label and icon colour.
backgroundColor string the theme’s primary colour Fill, for solid.
hoverColor, pressedColor string from the theme Fill on hover and while held.
padding, margin number or number[] 12, none In px. See Spacing.
borderRadius number or number[] 10 from the theme Corner radius in px.
borderColor, borderWidth string, number or number[] none, 2 Outline, drawn only when borderColor is set.
badge, badgeColor number, string none A count in a badge at the top right. 0 or less: no badge.
indicatorCount number none A count near the lower-right edge, shown as 99+ above 99.
unread boolean false An unread dot near the upper-right edge.
hoverWhenDisabled boolean false A disabled button still shows its tooltip.
disabled boolean false Dim the button and ignore presses.
Method What it does
press() Act as a pointer press would; nothing while disabled.
setText(text) Change the label.
setBadge(count) Change the badge count.
setDisabled(disabled) Disable or enable the button.
  • Press and release. A press counts when released over the same button. Releasing outside cancels it; you can move back over the button before releasing.
  • Link. With a Link component on the entity, a press opens the link instead of sending UIButton::press.
  • Decorative buttons. A subtle or bare button with no Signal Emitter, Link or menu takes no pointer at all, so decorative icons never block what is behind them.

The UI Checkbox component (comp-ui-checkbox) is a box with a label that turns on and off. With radio: true it draws a ring and dot, for radio buttons in a UI Selection Group. Entity: UI Checkbox (ent-ui-checkbox).

Prop Type Default Description
text string 'Checkbox' Label beside the box.
checked boolean false Whether it is on.
color string from the theme One colour for the border, label and mark.
size number 24 Width and height of the box in px.
radio boolean false Round ring and dot instead of a square box.
padding, margin number or number[] none In px.
disabled boolean false Dim the control and ignore presses.

Methods: toggle(), setChecked(checked), isChecked(). Event: UICheckbox::change { checked }.

The UI Switch component (comp-ui-switch) is an on/off switch: a pill track with a sliding handle and an optional label. Entity: UI Switch (ent-ui-switch), created with the text Switch.

Prop Type Default Description
text string none Label beside the track.
checked boolean false Whether it is on.
color string the theme’s primary colour Track colour while on.
padding, margin number or number[] none In px.
disabled boolean false Dim the control and ignore presses.

Methods: toggle(), setChecked(checked), isChecked(). Event: UISwitch::change { checked }.

The UI Toggle Button component (comp-ui-toggle-button) is a button that latches: a press flips checked, and the fill stays lit until the next press. Use it for state, such as a microphone on/off or the tool picked in a toolbar; group several with a UI Selection Group. Entity: UI Toggle Button (ent-ui-toggle-button), created with the text Toggle.

It takes the UI Button’s text, icon, iconPosition, align, size, fontSize, color, sizeScale, padding, margin, borderRadius, borderColor, borderWidth, badge and badgeColor, plus:

Prop Type Default Description
checked boolean false Whether it is on.
backgroundColor string the theme’s muted colour Fill while off.
checkedColor string the theme’s primary colour Fill while on.
hoverColor, pressedColor string from the theme Fill on hover and while held.
disabled boolean false Dim the button and ignore presses.

Methods: toggle(), setChecked(checked), isChecked(), setBadge(count). Event: UIToggleButton::change { checked }.

The UI Slider component (comp-ui-slider) picks a number by dragging: a header with the label and value, over a track with a fill and a thumb. Entity: UI Slider (ent-ui-slider).

Prop Type Default Description
text string none Header label, left of the value.
value number min Current value, stepped and kept within min to max.
min, max number 0, 100 The range.
step number 1 Step the value snaps to. 0 for a continuous value.
showValue boolean true Show the value in the header.
unit string none Unit after the shown value, such as '%'.
color string the theme’s primary colour Fill and thumb colour.
padding, margin number or number[] none In px.
disabled boolean false Dim the slider and ignore input.

Methods: getValue(), setValue(value). Events: UISlider::change { value } on every stepped change, and UISlider::change-end { value } once a drag is released with a different value. Pressing the track jumps to that value; pressing the thumb keeps its value until the drag moves it. A drag can continue outside the track.

Use change for live feedback (a volume that follows the thumb) and change-end for work that should run once (saving a setting, sending it over the network).

The UI Progress component (comp-ui-progress) shows progress as a bar or a ring, with a known value or an indeterminate animation. It takes no pointer. Entity: UI Progress (ent-ui-progress).

Prop Type Default Description
type 'linear' or 'circular' 'linear' A bar or a ring.
text string none Header label. Linear only.
value number min Current progress, kept within min to max.
min, max number 0, 100 The range.
showValue boolean true Show the value beside the label or in the ring.
unit string none Unit after the shown value.
color string the theme’s primary colour Fill or arc colour.
size number 64 Ring diameter in px. Circular only.
indeterminate boolean false Unknown duration: a segment sweeps along the bar, or the arc spins. value is ignored.
direction 'forward' or 'reverse' 'forward' Forward fills left to right, or clockwise from 12 o’clock.
padding, margin number or number[] none In px.

Methods: getValue(), setValue(value) (no effect while indeterminate), setIndeterminate(on), isIndeterminate(). Event: UIProgress::change { value }. The indeterminate motion animates in play only.

The UI Input component (comp-ui-input) is a text field with an optional header label. It keeps its own text: read it with getValue() or from its events. Entity: UI Input (ent-ui-input).

Prop Type Default Description
text string none Header label above the field.
value string '' Current text.
placeholder string none Grey text shown while empty.
icon string none A decorative icon name inside the field.
type 'text', 'password', 'number' 'text' Plain, masked, or numeric.
color string the theme’s primary colour Focus ring colour.
maxLength number 50 Most characters accepted.
maxRows number 1 Lines visible before the text scrolls. Above 1 the field is multiline.
clearable boolean false Show a clear button while the field has text.
virtualKeyboard boolean false Show the in-scene keyboard on desktop and mobile too. Ignored in VR.
embedded boolean false Use the surrounding UI for the field’s border and background.
focusOnSurface boolean false A press on the outer surface or padding focuses the field.
flexGrow number none Share of the free space in a row.
padding, margin number or number[] [8, 12], none In px.
disabled boolean false Dim the field and ignore input.

Methods: getValue(), setValue(text) (cut to maxLength, sends change), and the isFocused getter. Events: UIInput::change, UIInput::submit, UIInput::focus and UIInput::blur, each { text }.

  • Enter sends submit and closes the keyboard. In a multiline field, Shift+Enter adds a line instead.
  • Numbers. A number field keeps its value as text and asks for the numeric keyboard. The type is a keyboard hint, not validation: check the text yourself. Up and Down add or subtract 1.
  • Focus. A press outside the field and its keyboard drops focus, in XR too.
  • Password. A password field masks what is typed; getValue() still returns the real text in play.
  • In XR, a focused field uses the headset’s system keyboard when there is one. Otherwise the in-scene keyboard appears just below the field’s panel, tilted like a desk keyboard.
  • On desktop and mobile, the physical or on-screen keyboard of the device types. With virtualKeyboard: true the in-scene keyboard appears inside the view instead, for example on a touch kiosk.

The in-scene keyboard the runtime opens is one shared UI Keyboard, reused for every field. It shows the numeric layout for a number field and QWERTY for the rest.

The UI Keyboard entity (ent-ui-keyboard) is the in-scene keyboard. Its keys type into whichever UI Input has focus, so one keyboard serves every field. Place one in a scene for a fixed keyboard, such as on a kiosk, or let the runtime open its own. It carries one of two layouts:

  • UI Keyboard QWERTY (comp-ui-keyboard-qwerty, the default): letters, digits, backspace, space and enter. Shift capitalizes the next letter; ?123 opens a page of symbols and ABC returns to letters.
  • UI Keyboard Numeric (comp-ui-keyboard-numeric): 0 to 9, ., -, backspace and enter.

Scripts reach either layout as UIKeyboardComponent.

Prop Type Default Description
color string from the theme Key hover colour.
opacity number 0.98 Alpha of the keyboard’s fill.
padding, margin number or number[] 10, none In px.

Methods: show(), hide(), isShown(). Events: UIKeyboard::press { key }, UIKeyboard::show and UIKeyboard::hide. Shift and page switches do not send press. Every keyboard entity, including the one the runtime opens, comes with a Signal Emitter on the signal ui:keyboard, so you can hear key presses without any setup.

The UI List component (comp-ui-list) turns a layout into a scrolling list of selectable rows. The rows are UI List Item entities below it. Entity: UI List (ent-ui-list), a layout with no gap or padding so the rows read as one list. Add a UI Panel component to it for a fill.

Prop Type Default Description
selection 'none', 'single', 'multiple' 'single' How many rows can be selected. none leaves rows as plain actions.
scrollbar boolean true Draw a scrollbar while the content overflows.
scrollbarWidth number 6 Scrollbar thickness in px.
scrollbarColor string from the theme Scrollbar colour.
  • Scrolling. Set the list’s UI Layout height or maxHeight to make overflowing rows scroll. Touch and controller drags can start on a row; a tap still presses it.
  • Selection. In single, pressing a row selects it and deselects the rest. In multiple, a press flips the row.
  • Methods. On the component: selectedValues() returns the selected rows’ values, getItems() returns the rows. On the UI List entity: selectedValues(), scrollTo(x, y) to scroll to an offset in layout px, and the scrollPosition getter.
  • Events. UIList::select and UIList::deselect { value }, sent from the list entity, so one Signal Emitter on the list covers every row.

The UI List Item component (comp-ui-list-item) is one row of the nearest UI List above it: a left-aligned, subtle button that also shows a selected state. Entity: UI List Item (ent-ui-list-item), created with the text Item.

Prop Type Default Description
text string none Row text.
value string the entity’s name Identifier reported when the row is picked.
selected boolean false Whether the row starts selected.
icon, iconPosition, size as UI Button Icon, its side and size.
align 'left', 'center', 'right' 'left' Where icon and label sit.
fontSize, color, padding, margin, borderRadius as UI Button Label and box.
backgroundColor string none Resting fill; absent, the row is transparent.
selectedColor string the theme’s primary colour Fill while selected.
hoverColor, pressedColor string from the theme Fill on hover and while held.
badge, badgeColor as UI Button Badge count and fill.
disabled boolean false Dim the row and ignore presses.

Methods: isChecked(), setChecked(selected), and the value getter. Event: UIListItem::select { value } on every press of the row, whatever the list’s mode.

The UI Menu component (comp-ui-menu) makes its entity a menu trigger: pressing it opens a popup, and every UI element below the entity goes into the popup. The UI Menu entity (ent-ui-menu) is a UI Button with a UI Menu; the component also works on a UI Label or UI Avatar. Its entries are UI Menu Item entities.

Prop Type Default Description
trigger 'select' or 'hover' 'select' What opens the menu: a press, or hovering.
placement 'top', 'bottom', 'left', 'right' 'bottom' Side of the trigger the popup opens on.
alignment 'start', 'center', 'end' 'center' Alignment along that side.
layout 'vertical' or 'horizontal' 'vertical' Direction the entries flow.
gap number 4 Space between entries, in px.
offset number 4 Space between the trigger and the popup, in px.
padding number or number[] 6 Popup padding in px.
minWidth number 160 Minimum popup width in px.
backgroundColor, opacity string, number the theme’s surface, 0.95 Popup fill and its alpha.
borderRadius, borderColor, borderWidth 10, none, 2 Popup corners and outline.
open boolean false Whether the menu starts open.
  • Methods. On the component: open(), close(), toggle(), setOpen(open), isOpen(), getItems(), and setPlacement(side) to move the popup to another side for now (undefined goes back to the prop). On the UI Menu entity: open(), close(), toggle(), isOpen() and items().
  • Closing. The menu closes after an entry is chosen, on a press anywhere outside it, and when its scene leaves. A hover menu closes a quarter second after the pointer leaves both trigger and popup.
  • Submenus. A UI Menu on a menu item makes that entry open a submenu.
  • Events. UIMenu::open and UIMenu::close {}. A menu authored open sends nothing on load.

The UI Menu Item component (comp-ui-menu-item) marks its entity as an entry of the nearest UI Menu above it. It draws nothing itself: the look comes from the entity’s button. The UI Menu Item entity (ent-ui-menu-item) is a UI Button with a UI Menu Item.

Prop Type Default Description
value string the entity’s name Identifier reported when the entry is chosen.

Event: UIMenuItem::select { value }. The button also sends its own UIButton::press, so listen for one or the other. An entry that opens a submenu sends nothing.

The UI Tooltip component (comp-ui-tooltip) shows a text bubble beside a UI element while a pointer rests on it. Add it to any control or panel; the element itself is the trigger.

Prop Type Default Description
text string '' Bubble text. Empty: no tooltip.
placement 'top', 'bottom', 'left', 'right' 'top' Side of the element the bubble sits on.
offset number 8 Space between the element and the bubble, in px.
delay number 1000 Hover time before the bubble shows, in milliseconds.
color, backgroundColor string from the theme Text and bubble colours.
padding number or number[] [6, 12] Bubble padding in px.

Methods: show() shows the bubble at once, skipping the delay; hide(). Events: UITooltip::show and UITooltip::hide {}. Tooltips need hover, which mouse and XR rays have and touch screens do not: on mobile, call show() from a script when the hint matters.

Settings.jx
#pragma lifecycle(startup)
function startup() {
const music = findEntity('Music').getComponent(AudioComponent);
const slider = findEntity('Volume').getComponent(UISliderComponent);
const mute = findEntity('Mute').getComponent(UISwitchComponent);
slider.setProps({ text: 'Volume', min: 0, max: 100, step: 5, unit: '%' });
slider.setValue(80);
function apply() {
music.setVolume(mute.isChecked() ? 0 : slider.getValue() / 100);
}
on('settings:volume', (event) => {
if (event.eventType === EventType.UISlider.Change) apply();
});
on('settings:mute', (event) => {
if (event.eventType === EventType.UISwitch.Change) apply();
});
on('settings:reset', (event) => {
if (event.eventType !== EventType.UIButton.Press) return;
mute.setChecked(false);
slider.setValue(80);
});
}

How it works:

  • Each control has its own Signal Emitter and signal, so each listener only handles its control.
  • One apply function computes the volume from the current state of both controls, so the slider and the switch can never disagree.
  • The Reset button calls setChecked and setValue. Those send their own change events, which run the other two listeners and call apply again: the music follows without extra code.
ShopButton.jx
#pragma lifecycle(startup)
// Scene: a UI Button named 'Buy' (Signal Emitter: 'shop/buy')
// and a UI Label named 'Coins'. Other scripts emit 'coin' when the player picks one up.
const PRICE = 5;
let coins = 0;
let owned = 0;
function startup() {
const buy = findEntity('Buy').getComponent(UIButtonComponent);
const label = findEntity('Coins').getComponent(UILabelComponent);
function refresh() {
label.setProps({ text: `Coins: ${coins}` });
buy.setText(`Buy torch (${PRICE})`);
buy.setBadge(owned);
buy.setDisabled(coins < PRICE);
}
on('coin', () => {
coins += 1;
refresh();
});
on('shop/buy', (event) => {
if (event.eventType !== EventType.UIButton.Press) return;
coins -= PRICE;
owned += 1;
refresh();
});
refresh();
}

How it works:

  • setDisabled(true) dims the button and ignores presses, so the player cannot buy without enough coins; the press listener never runs then.
  • setBadge(owned) shows how many torches the player owns in the badge; a count of 0 hides it.
  • All state lives in plain variables, and refresh redraws every element from them after each change.
NameEntry.jx
#pragma lifecycle(startup)
function startup() {
const input = findEntity('Name').getComponent(UIInputComponent);
const greeting = findEntity('Greeting').getComponent(UILabelComponent);
input.setProps({ text: 'Your name', placeholder: 'Type and press Enter', maxLength: 20, clearable: true });
on('profile:name', (event) => {
if (event.eventType === EventType.UIInput.Change) {
greeting.setProps({ text: event.data.text ? `Hello, ${event.data.text}…` : '' });
}
if (event.eventType === EventType.UIInput.Submit) {
const name = event.data.text.trim();
if (!name) return;
greeting.setProps({ text: `Welcome, ${name}!`, color: '#4ade80' });
emit('profile/named', { name });
}
});
}

How it works:

  • UIInput::change arrives on every keystroke with the whole text, so the greeting follows as the player types.
  • UIInput::submit arrives when the player presses Enter (or the in-scene keyboard’s enter key). The script trims the text, ignores an empty name, and announces it to other scripts with emit.
  • The same code works in a headset: focusing the field opens the system keyboard or the in-scene keyboard automatically.
LoadingBar.jx
#pragma lifecycle(startup)
async function startup() {
const bar = findEntity('Loading').getComponent(UIProgressComponent);
const status = findEntity('Status').getComponent(UILabelComponent);
// Unknown duration first: a sweeping segment.
bar.setProps({ text: 'Preparing', unit: '%' });
bar.setIndeterminate(true);
status.setProps({ text: 'Connecting…' });
await new Promise((done) => delay(done, 1500));
// Then a known value, from 0 to 100 over three seconds.
bar.setIndeterminate(false);
bar.setProps({ text: 'Loading' });
await Tween.value(0, 100, (value) => bar.setValue(Math.round(value)), { duration: 3 });
status.setProps({ text: 'Ready' });
}

How it works:

  • startup is async, so it can await. delay(done, 1500) resolves the promise after 1.5 seconds of game time.
  • setIndeterminate(true) shows an animation for a wait of unknown length; setValue has no effect until it is turned off.
  • Tween.value runs the callback with values from 0 to 100 over three seconds, and setValue moves the bar. Only the fill is redrawn on each change.
LevelSelect.jx
#pragma lifecycle(startup)
function startup() {
const list = findEntity('Levels').getComponent(UIListComponent);
const play = findEntity('Play').getComponent(UIButtonComponent);
play.setDisabled(true);
on('levels', (event) => {
if (event.eventType === EventType.UIList.Select) {
play.setText(`Play ${event.data.value}`);
play.setDisabled(false);
}
});
on('levels/play', async (event) => {
if (event.eventType !== EventType.UIButton.Press) return;
const [level] = list.selectedValues();
if (level) await Scenes.load(level);
});
}

How it works:

  • One Signal Emitter on the list entity reports every row, because UIList::select comes from the list, not from the row.
  • The Play button stays disabled until something is selected.
  • When Play is pressed, selectedValues() returns the values of the selected rows; in single mode there is at most one. Scenes.load switches to the scene with that id.
FileMenu.jx
#pragma lifecycle(startup)
function startup() {
const fileEntity = findEntity('File');
const menu = fileEntity.getComponent(UIMenuComponent);
const click = findEntity('Key Click').getComponent(AudioComponent);
fileEntity.addComponent(new UITooltipComponent({ text: 'File actions', placement: 'bottom', delay: 500 }));
on('menu:file', (event) => {
if (event.eventType === EventType.UIMenu.Open) log('menu opened with', menu.getItems().length, 'entries');
});
// The entries are nested below the menu: listen on each entry's own emitter.
for (const item of menu.getItems()) {
item.entity.addComponent(new SignalEmitterComponent({ signal: 'menu:file-item', eventFilter: ['UIMenuItem::select'] }));
}
on('menu:file-item', (event) => {
log('chose', event.data.value);
if (event.data.value === 'quit') emit('game/quit');
});
// Every keyboard entity reports on 'ui:keyboard' by default.
on('ui:keyboard', (event) => {
if (event.eventType === EventType.UIKeyboard.Press) click.play();
});
}

How it works:

  • A UI Tooltip added to the menu trigger shows “File actions” after half a second of hover.
  • UIMenu::open comes from the menu’s own Signal Emitter. Each entry sends UIMenuItem::select from its own entity, so the script gives every entry an emitter on one shared signal, filtered to that event only.
  • Every in-scene keyboard reports on ui:keyboard without setup, so a key click sound takes three lines.
  • No Signal Emitter. A control without one sends nothing, and on never fires. Add the emitter to the control’s own entity, not to its panel (except for a UI List, whose events come from the list).
  • Not checking eventType. A signal can carry several kinds of events (change and change-end, focus and submit). Compare with EventType constants so each branch runs only for its event.
  • Feedback loops. setValue and setChecked send change events. A listener that sets the same control again in response can loop; set a different control, or compare before setting.
  • Listening to both UIMenuItem::select and UIButton::press on a menu entry runs your code twice. Pick one.
  • Trusting a number input. The number type only picks the keyboard. Parse and check the text yourself before using it.
  • Tooltips on touch screens. A touch has no hover, so a tooltip never appears on its own. Call show() when the hint matters.
  • A list that never scrolls. Without a height or maxHeight on the list’s layout, the list grows to fit all its rows instead of scrolling.