Mode input

A text field with a menu of modes on one side: choosing a mode applies its attributes to the field (type, placeholder, inputmode, pattern…), so one control says what a value is and the value — a file path or text, an amount in € or $, a search by name or ID. Everything else is ray-input.

Source on GitHub

Alt+↓ opens the menu from the field.
Code

API

For AI agents: this API as Markdown, or every component in llms-full.txt.

<ray-mode-input> · RayModeInput

Declare the modes as <option> children (label, data-icon, data-hint, data-description, disabled, and data-set-<attribute> for each attribute the mode sets on the field) or with the options property. A mode's attributes replace the field's own while it is chosen and give them back after. The menu is a ray-menu of radio items in the field's shadow root; Alt+ArrowDown opens it from the field, and the trigger keeps the caret in the field.

PropertyAttributeTypeDefaultDescription
modemode reflectsstringThe chosen mode's value (default: the first). Setting it applies that mode without ray-mode-change.
options—arrayThe modes; when not set, the <option> children.
displaydisplay reflectslabel | icon | bothWhat the trigger shows: the mode's hint or label, its icon, or both. Default: the icon when the mode has one, else the label.
positionposition reflectsstart | endstartThe side of the field the trigger sits on.
menuLabelmenu-labelstringMode (text mode-input.menu)The trigger's accessible name, read with the current mode ("Mode: File").
nativeMenunative-menu reflectsbooleanWith a native host (a std/ui window with the bridge), the system's menu (no descriptions there).
EventDescription
ray-mode-changeThe user chose a mode (mode is already the new one); cancelable: preventDefault keeps the previous mode.
PartDescription
triggerThe button that opens the menu.
trigger-iconThe current mode's icon in the trigger.
trigger-labelThe current mode's hint or label in the trigger.
menuThe ray-menu of modes.

Texts

What it writes itself, in English; setStrings() translates them (Getting started: Languages).

KeyEnglish
mode-input.menuMode