<kern-input>
Labelled text field (text, password, search, number …), form-associated. Use mono for IP, MAC, CIDR and IDs.
suggestions turns it into a combobox: typing shows the suggestions that contain the text (case-insensitive) in a list below the field, free text stays allowed. Arrow keys open the list and move, Enter or a click takes a suggestion, Escape and Tab close it. Taking one sets value and emits kernInput and kernChange like typing. Only for type text, search, email, url and tel.
Native checks (required, type="email"/url, pattern, min/max/step, maxlength) reach the form: an invalid value blocks submitting. Like :user-invalid, the browser's message is shown only after the value was changed or a submit failed. error takes priority.
Enter submits the surrounding form like a native field (with an open suggestion list it only takes the suggestion); no-implicit-submit turns that off.
Examples
Basic field
A labelled text field with hint, placeholder and required. Use mono for IP addresses, MAC addresses and IDs, and size="sm" in toolbars and tables.
Error, disabled and read-only
error shows a message and marks the field invalid, so it also blocks form submission. disabled fields are skipped by the form; readonly fields are submitted but cannot be edited.
Complete form
All Kern form fields are form-associated: they take part in a native <form>, in FormData, in validation and in reset. kern-button type="submit" and type="reset" work like native buttons. Leave a required field empty or enter a short password to see the validation; Reset restores the initial values.
Suggestions
suggestions offers known values while typing and still allows free text, like a native <datalist> but in the Kern style. It takes an array or a comma-separated string. The list shows the suggestions that contain the typed text (case-insensitive, match highlighted); Arrow keys open it and move, Enter or a click takes a suggestion, Escape and Tab close it. Taking one sets value and emits kernInput and kernChange like typing. Works with type text, search, email, url and tel.
In Angular, bind an array: <kern-input label="Location" [suggestions]="knownLocations" [(ngModel)]="location"></kern-input>.
Properties
ariaLabelTextstring | undefined
Accessible name when there is no visible label.
autocompletestring | undefined
disabledboolean
errorstring | undefined
Error text; also marks the field invalid.
hintstring | undefined
labelstring | undefined
maxnumber | string | undefined
maxlengthnumber | undefined
minnumber | string | undefined
For type="number".
monoboolean
namestring | undefined
noImplicitSubmitboolean
Enter does not submit the surrounding form.
patternstring | undefined
placeholderstring | undefined
readonlyboolean
requiredboolean
size"md" | "sm"
stepnumber | string | undefined
suggestionsstring | string[] | undefined
Values offered while typing; free text stays allowed. A string is split at commas.
type"email" | "number" | "password" | "search" | "tel" | "text" | "url"
valuestring
Events
kernChangeCustomEvent<{ value: string; }>
On every keystroke and when a suggestion is taken (also used by the Angular value accessor).
kernInputCustomEvent<{ value: string; }>
On every keystroke and when a suggestion is taken.
Methods
select()select() => Promise<void>
Selects the text.
setFocus()setFocus() => Promise<void>
Focuses the native input.
CSS parts
controlThe native input
listboxThe suggestion list
optionEach suggestion