Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Input

FreeNew

A text field in three sizes with hover, focus, invalid, read-only and disabled states.

Installation

pnpm dlx shadcn@latest add @viewport/input

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above.

input-demo.tsx
import { Input } from "@/components/viewport/input";

export default function InputDemo() {
  return (
    <div className="flex w-full max-w-sm flex-col gap-3">
      <Input aria-label="Full name" placeholder="Full name" autoComplete="name" />
      <Input aria-label="Work email" type="email" defaultValue="mara@northwind" aria-invalid autoComplete="email" />
      <div className="grid grid-cols-2 gap-3">
        <Input aria-label="City" size="sm" placeholder="Small" />
        <Input aria-label="Country" size="lg" placeholder="Large" />
      </div>
      <Input aria-label="Workspace ID" defaultValue="ws_7Fq2Lm" readOnly />
      <Input aria-label="Seats" placeholder="Disabled" disabled />
    </div>
  );
}

Props

PropTypeDefault
sizekeyof typeof sizes

Control height. All sizes use 16px text on phones so iOS does not zoom the page on focus.

"md"

Accessibility

  • A native input: set `aria-invalid` for the error state, or wrap it in Field.
  • 16px text on phones, so iOS does not zoom the page on focus.
  • Server component with no client JavaScript.
  • Respects prefers-reduced-motion.