Component

Input

Render text fields with prefix and suffix slots, validation state, and consistent control sizing.

Interactive preview

Usage

Import the component entry and start with its smallest complete example.

Import

import { Input } from "@chitrank2050/monoline-ui/input"

Basic usage

<Input placeholder="Search projects..." />
<Input size="sm" placeholder="Small input" />
<Input size="lg" placeholder="Large input" />
<Input variant="error" placeholder="Invalid value" />
<Input prefix="🔍" placeholder="Search docs..." />
<Input suffix="USD" placeholder="0.00" />

Usage guidance

Choose the component for its interaction model and semantics before customizing its appearance.

01
Use when

Input covers a single native text field with optional prefix, suffix, sizing, and error styling.

02
Avoid when

The field needs multiple lines, composite selection, or built-in validation messages.

03
Accessibility

Input wraps the native input in a label but provides no built-in label text, so supply an accessible name and describe errors with aria-invalid and aria-describedby when applicable.

04
Server Component

This component can render without adding a Monoline client boundary when its children and props are serializable.

API reference

Props, slots, and callbacks available on this component.

variantdefault | errorVisual validation status
sizesm | md | lgComponent scale
prefixReactNodeSlot for prefix icons or labels
suffixReactNodeSlot for suffix icons or labels
wrapperClassNamestringOptional class applied to outer label element

Design tokens

Theme variables this component reads for color, spacing, and motion.

--duration-microCSS varInteraction active transition duration
--inputCSS varDefault field borders and backgrounds

Implementation

The source used by the example above, including any state it needs.

import { Input } from "@chitrank2050/monoline-ui/input"

export function Form() {
  return (
    <div className="flex flex-col gap-3 max-w-sm">
      <Input prefix="@" placeholder="Username" />
      <Input placeholder="Enter password" type="password" />
    </div>
  )
}