Input Component

A form input component that provides a clean and accessible way to collect user input.

  • Accessible form input implementation
  • Support for various input types
  • Customizable styling
  • Error state handling
  • Icon support
  • Label integration

Installation

The Input component is part of our UI library. You can import it directly from the components directory.


Usage

Here is how to use the input in your project.

React TSX
1import { Input } from "@/components/modern-ui/input"

React TSX
1<Input type="text" placeholder="Enter text" />

Examples

Basic Input

Input with Label

Input with Icon

Input with Error

Username is required

API Reference

Input

PropTypeDefaultDescription
typestring"text"The type of input
valuestring-The controlled value of the input
defaultValuestring-The default value of the input
onChange(event: React.ChangeEvent<HTMLInputElement>) => void-Event handler called when the value changes
placeholderstring-Placeholder text
disabledbooleanfalseWhether the input is disabled
requiredbooleanfalseWhether the input is required
namestring-The name of the input
idstring-The id of the input
classNamestring-Additional CSS classes

Additionally, all standard HTML input attributes are supported.