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.
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.
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
mode | mode reflects | string | The chosen mode's value (default: the first). Setting it applies that mode without ray-mode-change. | |
options | — | array | The modes; when not set, the <option> children. | |
display | display reflects | label | icon | both | What the trigger shows: the mode's hint or label, its icon, or both. Default: the icon when the mode has one, else the label. | |
position | position reflects | start | end | start | The side of the field the trigger sits on. |
menuLabel | menu-label | string | Mode (text mode-input.menu) | The trigger's accessible name, read with the current mode ("Mode: File"). |
nativeMenu | native-menu reflects | boolean | With a native host (a std/ui window with the bridge), the system's menu (no descriptions there). |
| Event | Description |
|---|---|
ray-mode-change | The user chose a mode (mode is already the new one); cancelable: preventDefault keeps the previous mode. |
| Part | Description |
|---|---|
trigger | The button that opens the menu. |
trigger-icon | The current mode's icon in the trigger. |
trigger-label | The current mode's hint or label in the trigger. |
menu | The ray-menu of modes. |
Texts
What it writes itself, in English; setStrings() translates them (Getting started: Languages).
| Key | English |
|---|---|
mode-input.menu | Mode |