Text Input

Commonly used text input component.

Installation

npx wdc add input

Examples

Basic

Standard input fields with labels.

With Icons

Add icons or text as prefix/suffix. Padding adjusts automatically.

USD

Validation

Visual feedback for error and success states.

Please enter a valid email.

Looks good!

Password

Built-in visibility toggle for password fields.

Login Form

Login form with input fields

Welcome back

Enter your email to sign in to your account

Don't have an account? Sign up

API Reference

InputTypeDefaultDescription
labelstring''Text label displayed above the input.
type'text' | 'email' | 'password' | 'number''text'HTML input type.
placeholderstring''Placeholder text.
errorstring | nullnullError message text. Changes border color to red.
successbooleanfalseIf true, changes border color to green.
hintstring | nullnullHelper text displayed below the input.
size'sm' | 'default' | 'lg''default'Controls the height and font size.
check_circle
SEO & Accessibility

Using [id] on the input and [for] on the label ensures screen readers associate the label correctly. The aria-invalid and aria-describedby attributes help accessibility tools announce errors automatically.