Skip to main content

Input

scoped

Input element extends the capabilities of standard HTML input with advanced features and customization options.

Basic usage

This example shows a plain input in its most common setup, so the default markup, spacing, and typing behavior are easy to inspect.

Use in the form

This example places the input inside a real form so you can see submission flow and standard form interaction in context.

Variant: standard

Input also supports the visual of standard HTML input by adding the variant property with the value standard.

Standard in the form

This example combines the standard input variant with a form context so it is clear how it behaves in a typical form layout.

In combination with the Button elementorm, it creates a full-featured search box.

Pickers

In combination with the Button elementorm, it creates a full-featured search box.

Clearable

In combination with the Button elementorm, it creates a full-featured search box.

When to use

Use wje-input when users need to enter values, choose options, or trigger form-related actions.

When not to use

Do not use it as a decorative element without interaction. Prefer presentational components in that case.

Accessibility

Always provide a label (label/aria-label), keep keyboard support, and surface clear validation feedback.

Best Practices

  • Keep validation rules and error behavior consistent across the entire form.
  • Show loading or disabled states during async operations.
  • Split complex forms into smaller sections with immediate feedback.

Attributes and Properties

clearable

DescriptionSets or removes the 'clearable' attribute on the element. When set to a truthy value, the 'clearable' attribute is added; when falsy, the attribute is removed.
Attributeclearable
Typeboolean
Defaultfalse

customErrorDisplay

DescriptionGetter for the customErrorDisplay attribute.
Attributecustom-error-display
Typeboolean
Defaultfalse

disabled

DescriptionDisables user interaction with the component.
Attributedisabled
Typeboolean
Default-

errorInline

DescriptionControls whether validation errors are rendered inline.
Attributeerror-inline
Typeany
Default-

invalid

DescriptionControls validation or status messaging for invalid.
Attributeinvalid
Typeboolean
Defaultfalse

label

DescriptionRetrieves the value of the 'label' attribute if it exists. If the 'label' attribute is not set, it returns false.
Attributelabel
Typestring
Defaultfalse

message

DescriptionSets helper or validation text shown below the input.
Attributemessage
Typeany
Default-

name

DescriptionSets the field name used when submitting form data.
Attributename
Typeany
Default-

placeholder

DescriptionSets the placeholder value for an element. If the provided value is non-empty, it assigns the value to the "placeholder" attribute. Otherwise, it removes the "placeholder" attribute from the element.
Attributeplaceholder
Typestring
Default-

readonly

DescriptionPrevents the value from being edited by the user.
Attributereadonly
Typeboolean
Default-

required

DescriptionMarks the component as required for form validation.
Attributerequired
Typeboolean
Default-

type

DescriptionSets the input type that controls value parsing and validation.
Attributetype
Typeany
Default-

validateOnChange

DescriptionSets the validateOnChange property. If set to a truthy value, it adds the validate-on-change attribute to the element. If set to a falsy value, it removes the validate-on-change attribute from the element.
Attributevalidate-on-change
Typeboolean
Defaultfalse

value

DescriptionRetrieves the value from the input element if available; otherwise, returns the internal _value property or an empty string as the default.
Attributevalue
Typestring
Default-

variant

DescriptionSets the variant attribute on the element. If a value is provided, it will set the attribute to the given value. If no value is provided, it removes the variant attribute from the element.
Attributevariant
Typestring
Defaultdefault

Events

NameDescription
wje-input:inputDispatched when the input value changes.
wje-input:clearDispatched when the input is cleared.

Methods

hasSlot

DescriptionChecks whether the input has a slot.
Signature(el: HTMLElement, slotName: string) => boolean

CSS Shadow Parts

NameDescription
nativeThe native part.
wrapperThe wrapper part.
inputThe input part.
clearThe clear part.

CSS Custom Properties

NameDescription
--wje-input-font-familyDefines the font family for the input text.
--wje-input-background-colorSpecifies the background color of the input field.
--wje-input-colorSets the text color within the input field.
--wje-input-color-invalidChanges the text color when the input value is invalid.
--wje-input-border-colorDefines the border color of the input field.
--wje-input-border-color-focusSpecifies the border color when the input is focused.
--wje-input-border-widthSets the width of the input border.
--wje-input-border-styleDefines the border style of the input (e.g., solid, dashed).
--wje-input-border-radiusSpecifies the border radius, creating rounded corners.
--wje-input-margin-bottomAdds spacing below the input field.
--wje-input-line-heightSets the line height of the text within the input field.
--wje-input-slot-padding-inlineControls the padding on the left and right of the input slot content.

Slots

NameDescription
startSlot for content at the start of the input.
endSlot for content at the end of the input.