import { Input } from "@/components/ui/input"
export default function InputDemo() {
return <Input type="email" placeholder="Email" />
}Installation
npx logic2b@latest add inputWorking with an AI assistant? Copy this prompt into Claude Code, Cursor or Copilot — it carries the install steps, a no-CLI fallback and a verification checklist.
Add the "input" item from the logic2b ui registry (https://ui.logic2b.com) to this project. Follow every step and verify at the end. ## Steps 1. If the project has no `components.json` yet, set up logic2b ui first: ```bash npx logic2b@latest init ``` 2. Install the item (the CLI resolves registry dependencies automatically): ```bash npx logic2b@latest add input ``` 3. Install any npm dependencies the command prints. ## If the CLI is not available Do it manually from the registry payload: 1. Fetch https://ui.logic2b.com/r/input.json. 2. Write every entry in `files[]` to its mapped project path (see below). 3. Repeat (recursively) for each name in `registryDependencies`. 4. Install every package listed in `dependencies` across those payloads. ## Registry reference - Index of every item: https://ui.logic2b.com/r/index.json - Item payload (full source): https://ui.logic2b.com/r/<name>.json - Usage examples per item: https://ui.logic2b.com/r/demos/index.json → https://ui.logic2b.com/r/demos/<demo>.json - Docs index for agents: https://ui.logic2b.com/llms.txt (full docs: https://ui.logic2b.com/llms-full.txt) - Every docs page is Markdown when you append `.md` to its URL. Registry file paths map to project paths like this: - `ui/*` → `@/components/ui/*` - `blocks/<name>/*` → `@/components/*` - `charts/*` → `@/components/charts/*` - `hooks/*` → `@/hooks/*` - `lib/utils.ts` → `@/lib/utils.ts` - `theme.css` → next to the project's Tailwind entry stylesheet ## Conventions (do not break these) - Tailwind CSS v4 (CSS-first config; no tailwind.config.js needed) and React 19. - All colors go through semantic tokens (`bg-primary`, `text-muted-foreground`, `border-border`, …). Never hardcode hex/oklch values in components. - Dark mode is class-based: toggle `.dark` on `<html>`. - Icons come from lucide-react. ## Verify before finishing 1. The dev server starts and the app renders without console errors. 2. TypeScript compiles (`tsc --noEmit` or the framework's check). 3. Components use the theme: a `<Button>` shows the primary token color, and toggling `.dark` on `<html>` switches the palette.
Copy into 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(
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
className
)}
{...props}
/>
)
}
export { Input }Usage
import { Input } from "@/components/ui/input"
<Input type="email" placeholder="Email" />
Supports every native input type including file. Invalid state styling via
aria-invalid.
API
Input renders a native <input> and forwards every standard attribute
(React.ComponentProps<"input">).
| Prop | Type | Default |
|---|---|---|
type |
string — any native input type (text, email, file, …) |
text |
disabled |
boolean |
false |
aria-invalid |
boolean — applies the destructive ring/border |
— |
placeholder |
string |
— |
className |
string |
— |
Examples
File
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
export default function InputFileDemo() {
return (
<div className="grid w-full max-w-sm items-center gap-3">
<Label htmlFor="input-file">Picture</Label>
<Input id="input-file" type="file" />
</div>
)
}Disabled
import { Input } from "@/components/ui/input"
export default function InputDisabledDemo() {
return <Input disabled type="email" placeholder="Email" />
}Invalid
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
export default function InputInvalidDemo() {
return (
<div className="grid w-full max-w-sm items-center gap-3">
<Label htmlFor="input-invalid">Email</Label>
<Input
id="input-invalid"
type="email"
aria-invalid
defaultValue="not-an-email"
/>
</div>
)
}