Skip to main content

Overview

Default
Focus
invalid-email
⚠ Enter a valid email
ahmad.dani
✓ Username available
The Input component is the foundational form element for capturing single-line text. It supports labels, placeholder text, leading/trailing icons, helper text, and four validation states.

Installation


Usage


Variants

Default

The standard input with a label above and optional placeholder.

With Helper Text

••••••••
Must be at least 8 characters

Required Field

Enter your full name

With Leading Icon

Search anything…

States

Default
Default
Focused
Focus
Error value
⚠ Error message
Valid value
✓ Looks good
Disabled
Disabled
Avoid hiding inputs when they are unavailable. Use the disabled prop so users can still see the field exists.

API Reference

string
default:"text"
HTML input type. Values: text · email · password · number · search · tel · url
string
Label displayed above the input field.
string
Placeholder text shown when the field is empty.
string
Helper or error message displayed below the input.
string
default:"default"
Validation state. Values: default · error · success · disabled
ReactNode
Icon rendered inside the input on the left side.
ReactNode
Icon rendered inside the input on the right side.
boolean
default:"false"
Marks the label with a required asterisk indicator.
boolean
default:"false"
Disables the input and applies the disabled visual style.
string
Controlled value of the input.
(e: ChangeEvent) => void
Change event handler.
string
Additional Tailwind classes for custom overrides.

Accessibility

  • Input uses native <input> element with semantic <label> association via id/htmlFor
  • Error messages are linked via aria-describedby so screen readers announce them
  • Required fields use the required HTML attribute in addition to the visual asterisk
  • disabled inputs carry the native disabled attribute — they are excluded from tab order
  • Focus ring (0 0 0 4px #CDE4F5) meets WCAG 2.1 AA contrast requirements

Do’s & Don’ts

Do

  • Always provide a visible label — never rely on placeholder alone
  • Use helperText to explain the expected format before the user submits
  • Use state="error" with a descriptive helperText for inline validation
  • Group related inputs inside a Form component for consistent spacing

Don't

  • Don’t use placeholder text as a substitute for a label
  • Don’t show error state until after the user has interacted with the field (avoid premature validation)
  • Don’t use custom border colors outside the design system states
  • Don’t disable inputs without explaining why — add a tooltip or helper text