Kern 0.12.0 GitHub
Fundamentals

Forms

All input components are form-associated (ElementInternals): they take part in <form> like native fields.

What works like native fields

Enter submits

The native input of a Kern field sits in the shadow DOM and belongs to no form, so the field submits the form itself on Enter, as the browser does for native fields. This applies to kern-input, kern-ip-input, kern-mac-input, kern-step-input, kern-date-picker, kern-date-range-picker, kern-time-picker and kern-color-picker.

Errors

Set error to show a message. A field with error is invalid and blocks submitting until the message is removed. Typed fields (dates, IPs, MACs, numbers, colours) also report their own problems, e.g. «Not a valid IPv4 address».

kern-input passes the native checks to the form: required, type="email" / "url", pattern, maxlength and min / max / step for numbers. An invalid value blocks submitting. Like :user-invalid, the browser's message («Please enter an email address») shows only after the value was changed or a submit failed; correcting the value removes it and form.reset() hides it again. error wins over native problems.

Save Reset

Events

Normalised values

Typed fields accept several notations and store one: kern-ip-input («192.168.1.10 - 50» → 192.168.1.10-192.168.1.50), kern-mac-input (any notation → C8:2B:96:1A:3F:00), kern-date-picker (locale text → ISO 2026-10-19), kern-color-picker (#3CC → #33cccc).

Angular

The generated value accessors connect ngModel and reactive forms: text accessor for most fields, number accessor for kern-rating and kern-step-input, boolean accessor for kern-switch and kern-checkbox. kern-file-input has none; use (kernChange).