kanso/ui
Form

Input

A single-line text field.

LiveRev. 01

At least 3 characters.

Installation

CLI

$ npx shadcn@latest add https://konsa.rohitxyz.me/r/input.json

Manual

Copy the source into your project

components/ui/input.tsx
import * as React from "react";

import { cn } from "@/lib/utils";

function Input({ className, type, ...props }: React.ComponentProps<"input">) {
  return (
    <input
      type={type}
      data-slot="input"
      className={cn(
        "flex h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[border-color,box-shadow] outline-none placeholder:text-muted-foreground",
        "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/15",
        "aria-invalid:border-destructive aria-invalid:ring-destructive/15",
        "file:mr-3 file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground",
        "disabled:cursor-not-allowed disabled:opacity-50",
        className,
      )}
      {...props}
    />
  );
}

export { Input };

Update the import paths to match your project

The file imports cn from @/lib/utils. See installation.

Usage

import { Input } from "@/components/ui/input";
<Input type="email" placeholder="you@example.com" />
Input