Skip to content

wc-text-input

apps/docs/src/content/docs/component-library/wc-text-input Click to copy
Copied! apps/docs/src/content/docs/component-library/wc-text-input
<wc-text-input>

Form-associated text input with built-in label, error, and help text.

A text input component with label, validation, and form association.

Simple text input with label.

Basic

Different native input types.

Input Types

Guidance text below the input.

Help Text

Input with error message displayed.

Error State

Required field indicator.

Required

Non-interactive disabled state.

Disabled

Content before and after the input.

Prefix & Suffix Slots

https://$USD

Multiple states side by side.

Validation States

Properties

10
AttributeTypeDefaultDescription
labelstring''The visible label text for the input.
placeholderstring''Placeholder text shown when the input is empty.
valuestring''The current value of the input.
type'text' | 'email' | 'password' | 'tel' | 'url' | 'search' | 'number''text'The type of the native input element.
requiredbooleanfalseWhether the input is required for form submission.
disabledbooleanfalseWhether the input is disabled.
errorstring''Error message to display. When set, the input enters an error state.
help-textstring''Help text displayed below the input for guidance.
namestring''The name of the input, used for form submission.
aria-labelstring | nullnullAccessible name for screen readers, if different from the visible label.

Events

2
NameTypeDescription
wc-inputCustomEvent<{value: string}>Dispatched on every keystroke as the user types.
wc-changeCustomEvent<{value: string}>Dispatched when the input loses focus after its value changed.

Slots

3
NameDescription
prefixContent rendered before the input (e.g., icon).
suffixContent rendered after the input (e.g., icon or button).
help-textCustom help text content (overrides the helpText property).

CSS Custom Properties

8
PropertyDescription
--wc-input-bgInput background color.
--wc-input-colorInput text color.
--wc-input-border-colorInput border color.
--wc-input-border-radiusInput border radius.
--wc-input-font-familyInput font family.
--wc-input-focus-ring-colorFocus ring color.
--wc-input-error-colorError state color.
--wc-input-label-colorLabel text color.

CSS Parts

6
PartDescription
fieldThe outer field container.
labelThe label element.
input-wrapperThe wrapper around prefix, input, and suffix.
inputThe native input element.
help-textThe help text container.
errorThe error message container.