Skip to content

Input

Allows users to enter and edit text, supporting various types, states, and customization.

First release: 1.0.0 Latest update: July 1, 2025 Current version: 1.0.0

React Angular Vue Svelte HTML

Import

import { PlusInput } from '@plusui/react';
import { PlusInputComponent } from '@plusui/angular';
import { PlusInput } from '@plusui/vue';
import PlusInput from '@plusui/svelte';
<script src="https://cdn.jsdelivr.net/npm/@plusui/core"></script>

Package

@plusui/react
@plusui/angular
@plusui/vue
@plusui/svelte
@plusui/core

Docs

Changelog

Input Changelog

Recent changes and updates for the input component

v1.0.0

June 26, 2025
Fix

Corrected the icon mapping for the password visibility toggle.

  • The `eye` and `eye-slash` icons were reversed and now show the correct state.
  • This change is part of the "Form System Critical Fixes" EPIC (#72).
Feat

Added Input component with validation support

  • Multiple input types: text, email, password, number, search, tel, url
  • Built-in validation with error states
  • Prefix and suffix icons
  • Clear button functionality
  • Password visibility toggle
  • Full accessibility support

The Input component is a versatile UI element used to capture user input, such as text, numbers, emails, or passwords. It supports various types, validation, prefixes/suffixes, and states like disabled or error.

Input - anatomy

A standard text input with a label and placeholder.

Show code

The type prop determines the input’s behavior and validation (e.g., email, password, number).

Show code

Control the input’s dimensions using the size prop.

Show code

Set the disabled attribute or prop to prevent user interaction.

Show code

Set the readonly attribute or prop to prevent modification while allowing focus and selection.

Show code

Add the clearable attribute or prop to show a button that clears the input’s value.

Show code

For type="password", use password-toggle to add an icon that toggles visibility. Control visibility with password-visible.

Show code

Use the prefix and suffix slots or the prefix-icon and suffix-icon props to add elements inside the input.

$USD
Show code

Use the error prop and error-message or caption prop to display validation feedback. Native HTML5 validation attributes (required, pattern, minlength, etc.) are supported.

Show code
Input - layout spacing Input - light & dark mode
  • Keyboard Behavior:
    • Standard text input navigation and interaction (Tab to focus, typing, arrow keys, Home/End, Delete/Backspace).
    • Clear button and password toggle button (if present) are focusable via Tab and activatable with Enter or Space.
  • Screen Reader:
    • The label prop is crucial for associating a visible label with the input. The component automatically links them using for and id.
    • aria-describedby is used to link the input with the caption or error-message content.
    • aria-invalid is set automatically based on the error state or native validation.
    • aria-required is set based on the required prop.
    • aria-disabled and aria-readonly reflect the respective props.
    • Clear and password toggle buttons have appropriate aria-label attributes.
  • Required Developer Actions:
    • Always provide a meaningful label prop.
    • Use the caption or error-message prop for supplemental instructions or error feedback.
    • Ensure sufficient color contrast if customizing colors.
    • Use appropriate type and validation attributes (pattern, required, etc.) for the expected data format.
    • Consider using the autocomplete attribute to improve user experience.
NameTypeDefaultDescriptionRequired
type'date' | 'datetime-local' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url''text'The type of control to display.No
namestring''The name of the input, submitted with form data.No
valuestring''The current value of the input.No
placeholderstring''Placeholder text shown when the input is empty.No
size'sm' | 'md' | 'lg''md'The size of the input control.No
clearablebooleanfalseAdds a clear button to the input.No
disabledbooleanfalseDisables the input.No
readonlybooleanfalseMakes the input read-only.No
requiredbooleanfalseMakes the input required for form submission.No
passwordTogglebooleanfalseShows a toggle button to reveal/hide password (only for type="password").No
passwordVisiblebooleanfalseControls the visibility state when passwordToggle is true.No
labelstringundefinedThe label text for the input.No
patternstringundefinedA regex pattern the value must match for validation.No
minlengthnumberundefinedMinimum length (number of characters) of value.No
maxlengthnumberundefinedMaximum length (number of characters) of value.No
minnumber | stringundefinedMinimum value for numeric or date types.No
maxnumber | stringundefinedMaximum value for numeric or date types.No
stepnumber | 'any'undefinedSpecifies the legal number intervals for numeric or date types.No
autocorrect'off' | 'on'undefinedControls whether autocorrect is enabled.No
autocompletestringundefinedHints for form autofill.No
autoFocusbooleanundefinedAutomatically focuses the input when the page loads.No
enterkeyhint'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send'undefinedHint for the virtual keyboard’s enter key.No
inputmode'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'undefinedHint for the type of data expected.No
spellCheckbooleanundefinedControls whether spell check is enabled.No
captionstringundefinedHelper text displayed below the input.No
errorbooleanfalsePuts the input in an error state.No
errorMessagestring''Error message displayed below the input when in error state (overrides caption).No
fullWidthbooleanfalseMakes the input span the full width of its container.No
isSelectbooleanfalseInternal prop indicating if the input is part of a select component (affects styling).No
prefixIconstringundefinedIcon name to display in the prefix slot area.No
suffixIconstringundefinedIcon name to display in the suffix slot area.No
NamePayload TypeDescription
plus-inputCustomEvent<void>Fired whenever the input’s value changes.
plus-changeCustomEvent<void>Fired when the input’s value changes and it loses focus.
plus-focusCustomEvent<void>Fired when the input gains focus.
plus-blurCustomEvent<void>Fired when the input loses focus.
plus-clearCustomEvent<void>Fired when the clear button is clicked.
plus-password-toggleCustomEvent<{ visible: boolean }>Fired when the password visibility toggle is clicked.
plus-invalidCustomEvent<{ validationMessage: string }>Fired when the input fails native validation after interaction (e.g., on blur or form submit).
NameParametersReturnsDescription
checkValidity()—booleanChecks if the input’s value satisfies its validation constraints.
reportValidity()—booleanChecks validity and reports errors if invalid. Focuses the input if invalid.
setCustomValidity()message: stringvoidSets a custom validation message. An empty string means the input is valid.
NameDescription
prefixContent placed inside the input, before the text value.
suffixContent placed inside the input, after the text value.
PartDescription
baseThe main container element.
inputThe native <input> element.
wrapperThe wrapper div around the input/slots.
prefixThe container for prefix content.
suffixThe container for suffix content.
clear-buttonThe clear button element.
password-toggleThe password toggle button element.
labelThe label element.
captionThe caption/error message element.

No specific public CSS custom properties are defined for direct styling. Use standard CSS targeting the element or shadow parts for customization.

Join the Community

Plus UI is built by the community. Join us on our platforms to contribute, get help, and stay up to date.