Skip to content

Input

Single-line text input. Since it renders a plain <input> with no associated <label>, always set label (used as aria-label) — and when hasError is true, also set describedBy to point at the id of your visible error message, otherwise screen readers announce the field as invalid without saying why.

Renders in light DOM (scoped styles, not Shadow DOM) on purpose: the <input> this component renders is a real descendant of whatever <form> wraps it, so FormData, native required/pattern validation, autofill, and password managers all work without any extra wiring.

<and-input
label="Email address"
type="email"
placeholder="you@example.com"
name="email"
></and-input>
PropertyAttributeDescriptionTypeDefault
customClassclassAdditional CSS classes from the consumer.string''
describedBydescribed-byID of the element that describes this input (e.g. error message).string''
disableddisabledDisables interaction when true.booleanfalse
hasErrorhas-errorWhether the input is in an error state.booleanfalse
labellabelAccessible label for the input (used when no visible label exists).string''
namenameName attribute forwarded to the native input — required for it to show up in FormData.string''
placeholderplaceholderPlaceholder text for the input.string''
requiredrequiredMarks the input as required.booleanfalse
typetypeHTML input type."email" | "number" | "password" | "search" | "tel" | "text" | "url"'text'
valuevalueCurrent value of the input.string''
EventDescriptionType
andInputBlurEmitted when the input loses focus.CustomEvent<void>
andInputChangeEmitted when the input value changes.CustomEvent<string>