Input
A text field with label, description and error (Mantine's TextInput). Form-associated.
Highlighted text
API
For AI agents: this API as Markdown, or every component in llms-full.txt.
<ray-input> · RayInput
Also forwards placeholder, autocomplete, inputmode, pattern, min, max, step, minlength, maxlength, spellcheck, autocapitalize, enterkeyhint and list to the inner input. Enter submits its form as a native field does: through the first submit button (ray-button type="submit" included; nothing when it is disabled), or, without one, only when the form has a single text field.
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
value | value | string | Current value. The value attribute is the initial value (restored on form reset). | |
type | type reflects | text | email | password | search | number | url | tel | time | date | datetime-local | text | Input type. time, date and datetime-local show the browser's picker (the native one on phones); value is what the input gives: "HH:MM", "YYYY-MM-DD", "YYYY-MM-DDTHH:MM". |
name | name reflects | string | Form field name. | |
label | label | string | Visible label (also the accessible name). | |
description | description | string | Help text under the label. | |
descriptionPosition | description-position reflects | above | below | above | The description before the control (help first) or after it, with the error (fields in a row stay aligned). |
error | error | string | Error text; marks the field invalid (display only — does not block submit). | |
placeholder | placeholder | string | Placeholder text. | |
required | required | boolean | Required for form submission; shows an asterisk. | |
disabled | disabled | boolean | Not editable nor submitted. | |
readonly | readonly | boolean | Not editable, still submitted. | |
size | size reflects | xs | sm | md | lg | xl | sm | Height and font size. |
radius | radius | xs | sm | md | lg | xl | full | Corner radius. | |
variant | variant reflects | default | filled | unstyled | default | Box style. |
highlight | — | function | Marks ranges of the text, painted behind it: called with the text on every change (typed or set), it returns { start, end, kind?, title? } offsets. kind "error" is red with a wavy underline; any other kind is styled with ::part(highlight-<kind>); title is the tooltip over the range. Ranges must not overlap. | |
complete | — | function | Inline suggestions: called as the user types (and on Ctrl+Space) with the text and the caret, it returns the part of the text a suggestion would replace and the suggestions ({ from, to, items }), or null for none. A list opens under that part (ArrowUp/Down, Enter or Tab to accept, Escape to close); the chosen item's value replaces from–to as an undoable edit, then ray-complete fires. The field becomes a combobox (aria-autocomplete, aria-expanded, aria-activedescendant). | |
suggestionsLabel | suggestions-label | string | Suggestions (text input.suggestions) | Accessible name of the suggestion list. |
| Attribute | Description |
|---|---|
autocomplete | Forwarded to the inner input. |
inputmode | Virtual keyboard hint. |
pattern | Validation pattern (regular expression). |
min | Minimum (number/date types). |
max | Maximum (number/date types). |
step | Step (number types). |
minlength | Minimum length. |
maxlength | Maximum length. |
autocapitalize | Mobile auto-capitalization. |
enterkeyhint | Label of the Enter key on virtual keyboards. |
list | Id of a <datalist> with suggestions. |
| Event | Description |
|---|---|
ray-complete | A suggestion was accepted (the text already has it). |
ray-highlight-hover | The highlight range under the pointer changed: the range and the box of the line of it the pointer is on, or null on leaving a range. Anchor a ray-popover to rect (its anchor property) to show more than the title. |
input | On every edit (value already updated). |
change | When an edit is committed (blur, Enter). |
| Slot | Description |
|---|---|
left | Section before the text (icon). |
right | Section after the text (icon, button). |
| Part | Description |
|---|---|
input | The inner <input>. |
wrapper | The box around the input and sections. |
label | The label. |
description | The description. |
error | The error message. |
suggestions | The suggestion list (a listbox in the top layer). |
suggestion | Each suggestion ([aria-selected] when active). |
suggestion-label | A suggestion's label (in the mono font). |
suggestion-detail | A suggestion's detail. |
suggestion-description | A suggestion's description, under its label (in the interface font). |
highlight | Each marked range (also highlight-<kind> for a range with a kind). |
text-layer | The layer behind the text that holds the marks. |
Texts
What it writes itself, in English; setStrings() translates them (Getting started: Languages).
| Key | English |
|---|---|
input.suggestions | Suggestions |