Input

A text field with label, description and error (Mantine's TextInput). Form-associated.

Source on GitHub

Highlighted text
Code

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.

PropertyAttributeTypeDefaultDescription
valuevaluestringCurrent value. The value attribute is the initial value (restored on form reset).
typetype reflectstext | email | password | search | number | url | tel | time | date | datetime-localtextInput 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".
namename reflectsstringForm field name.
labellabelstringVisible label (also the accessible name).
descriptiondescriptionstringHelp text under the label.
descriptionPositiondescription-position reflectsabove | belowaboveThe description before the control (help first) or after it, with the error (fields in a row stay aligned).
errorerrorstringError text; marks the field invalid (display only — does not block submit).
placeholderplaceholderstringPlaceholder text.
requiredrequiredbooleanRequired for form submission; shows an asterisk.
disableddisabledbooleanNot editable nor submitted.
readonlyreadonlybooleanNot editable, still submitted.
sizesize reflectsxs | sm | md | lg | xlsmHeight and font size.
radiusradiusxs | sm | md | lg | xl | fullCorner radius.
variantvariant reflectsdefault | filled | unstyleddefaultBox style.
highlight—functionMarks 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—functionInline 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).
suggestionsLabelsuggestions-labelstringSuggestions (text input.suggestions)Accessible name of the suggestion list.
AttributeDescription
autocompleteForwarded to the inner input.
inputmodeVirtual keyboard hint.
patternValidation pattern (regular expression).
minMinimum (number/date types).
maxMaximum (number/date types).
stepStep (number types).
minlengthMinimum length.
maxlengthMaximum length.
autocapitalizeMobile auto-capitalization.
enterkeyhintLabel of the Enter key on virtual keyboards.
listId of a <datalist> with suggestions.
EventDescription
ray-completeA suggestion was accepted (the text already has it).
ray-highlight-hoverThe 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.
inputOn every edit (value already updated).
changeWhen an edit is committed (blur, Enter).
SlotDescription
leftSection before the text (icon).
rightSection after the text (icon, button).
PartDescription
inputThe inner <input>.
wrapperThe box around the input and sections.
labelThe label.
descriptionThe description.
errorThe error message.
suggestionsThe suggestion list (a listbox in the top layer).
suggestionEach suggestion ([aria-selected] when active).
suggestion-labelA suggestion's label (in the mono font).
suggestion-detailA suggestion's detail.
suggestion-descriptionA suggestion's description, under its label (in the interface font).
highlightEach marked range (also highlight-<kind> for a range with a kind).
text-layerThe layer behind the text that holds the marks.

Texts

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

KeyEnglish
input.suggestionsSuggestions