scoped
Input element extends the capabilities of standard HTML input with advanced features and customization options.
This example shows a plain input in its most common setup, so the default markup, spacing, and typing behavior are easy to inspect.
This example places the input inside a real form so you can see submission flow and standard form interaction in context.
Input also supports the visual of standard HTML input by adding the variant property with the value standard.
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.
In combination with the Button elementorm, it creates a full-featured search box.
In combination with the Button elementorm, it creates a full-featured search box.
Use wje-input when users need to enter values, choose options, or trigger form-related actions.
Do not use it as a decorative element without interaction. Prefer presentational components in that case.
Always provide a label (label/aria-label), keep keyboard support, and surface clear validation feedback.
- 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.
| Description | Sets 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. |
| Attribute | clearable |
| Type | boolean |
| Default | false |
| Description | Getter for the customErrorDisplay attribute. |
| Attribute | custom-error-display |
| Type | boolean |
| Default | false |
| Description | Disables user interaction with the component. |
| Attribute | disabled |
| Type | boolean |
| Default | - |
| Description | Controls whether validation errors are rendered inline. |
| Attribute | error-inline |
| Type | any |
| Default | - |
| Description | Controls validation or status messaging for invalid. |
| Attribute | invalid |
| Type | boolean |
| Default | false |
| Description | Retrieves the value of the 'label' attribute if it exists. If the 'label' attribute is not set, it returns false. |
| Attribute | label |
| Type | string |
| Default | false |
| Description | Sets helper or validation text shown below the input. |
| Attribute | message |
| Type | any |
| Default | - |
| Description | Sets the field name used when submitting form data. |
| Attribute | name |
| Type | any |
| Default | - |
| Description | Sets 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. |
| Attribute | placeholder |
| Type | string |
| Default | - |
| Description | Prevents the value from being edited by the user. |
| Attribute | readonly |
| Type | boolean |
| Default | - |
| Description | Marks the component as required for form validation. |
| Attribute | required |
| Type | boolean |
| Default | - |
| Description | Sets the input type that controls value parsing and validation. |
| Attribute | type |
| Type | any |
| Default | - |
| Description | Sets 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. |
| Attribute | validate-on-change |
| Type | boolean |
| Default | false |
| Description | Retrieves the value from the input element if available; otherwise, returns the internal _value property or an empty string as the default. |
| Attribute | value |
| Type | string |
| Default | - |
| Description | Sets 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. |
| Attribute | variant |
| Type | string |
| Default | default |
| Name | Description |
|---|
wje-input:input | Dispatched when the input value changes. |
wje-input:clear | Dispatched when the input is cleared. |
| Description | Checks whether the input has a slot. |
| Signature | (el: HTMLElement, slotName: string) => boolean |
| Name | Description |
|---|
native | The native part. |
wrapper | The wrapper part. |
input | The input part. |
clear | The clear part. |
| Name | Description |
|---|
--wje-input-font-family | Defines the font family for the input text. |
--wje-input-background-color | Specifies the background color of the input field. |
--wje-input-color | Sets the text color within the input field. |
--wje-input-color-invalid | Changes the text color when the input value is invalid. |
--wje-input-border-color | Defines the border color of the input field. |
--wje-input-border-color-focus | Specifies the border color when the input is focused. |
--wje-input-border-width | Sets the width of the input border. |
--wje-input-border-style | Defines the border style of the input (e.g., solid, dashed). |
--wje-input-border-radius | Specifies the border radius, creating rounded corners. |
--wje-input-margin-bottom | Adds spacing below the input field. |
--wje-input-line-height | Sets the line height of the text within the input field. |
--wje-input-slot-padding-inline | Controls the padding on the left and right of the input slot content. |
| Name | Description |
|---|
start | Slot for content at the start of the input. |
end | Slot for content at the end of the input. |