Skip to content

Input

Text input component with support for icons, validation states, and various input types.

Import

tsx
import { ZInput } from "@zurto/ui";

Basic Usage

ZInput

With Label

ZInput

Required Field

ZInput

Input Types

ZInput

Sizes

ZInput

With Icons

ZInput

Validation States

Error State

ZInput
Please enter a valid email address

Success State

ZInput

With Helper Text

ZInput
Must be at least 8 characters

Disabled State

ZInput

Props

PropTypeDefaultDescription
type'text' | 'email' | 'password' | 'number' | 'search' | 'tel' | 'url''text'HTML input type
size'sm' | 'md' | 'lg''md'Input size
labelstringLabel text above the input
placeholderstringPlaceholder text
valuestringControlled input value
defaultValuestringDefault value for uncontrolled input
onChange(e: ChangeEvent) => voidChange event handler
leftIconReactNodeIcon displayed on the left
rightIconReactNodeIcon displayed on the right
errorstring | booleanError state or error message
successbooleanfalseSuccess validation state
hintstringHelper text below input
disabledbooleanfalseDisable the input
requiredbooleanfalseMark as required
clearablebooleanfalseShow clear button when input has value

Accessibility

  • Uses native <input> element with proper type attribute
  • aria-invalid="true" applied on error state
  • aria-describedby links input to error/hint message
  • aria-required applied when required
  • Clear button is keyboard accessible with proper aria-label

Keyboard Support

KeyAction
TabMove focus to/from input
EscapeClear input (when clearable)
EnterSubmit form (in form context)

Released under the MIT License.