Command Palette

Search for a command to run...

Docs
Input

Input

Displays a form input field or a component that looks like an input field.

Installation

Run the following command:

Update your imports:
import { Input } from "@/components/ui/input"

Usage

import { Input } from "@/components/ui/input";
 
export default function Home() {
  return (
    <Input type="email" placeholder="Email" />
  );
}

Usage with Icon

import { Input } from "@/components/ui/input";
import { Mail } from "lucide-react";
 
export default function Home() {
  return (
    <Input
      type="email"
      placeholder="Email Address"
      Icon={Mail}
      iconPlacement="left"
    />
  );
}

Props

PropTypeDefaultDescription
variantdefault | underline | pilldefaultStyle variant of the input
inputSizexs | sm | md | lg | xl | 2xlmdSize of the input
asChildbooleanfalseRender as a child component
IconReact.ElementType-Icon component to be displayed
iconPlacementleft | rightleftPlacement of the icon

HTML & Radix UI Props

The Input component supports:

HTML Attributes

Standard HTML input attributes (except 'size' which is replaced by inputSize):
  • type
  • placeholder
  • disabled
  • required
  • readOnly
  • value
  • onChange
  • onFocus
  • onBlur
  • aria-* attributes
  • data-* attributes
The Input component ensures proper accessibility and semantic HTML.