Input
inputA text field with a real label, optional description, an error that is announced and wired up with aria-describedby, and room for an icon on either side. Sizes and the invalid state come from the same tokens as every other Forme surface.
"use client";
import { Eye, EyeOff, Lock, Mail, Search } from "lucide-react";
import { useState } from "react";
import { Input } from "@/components/forme/input/input";
export function InputDemo() {
const [visible, setVisible] = useState(false);
return (
<div className="flex flex-col gap-8">
<div className="grid max-w-sm gap-4">
<Input label="Email" placeholder="you@company.com" leading={<Mail />} />
<Input
label="Workspace"
description="Lowercase letters, digits and dashes."
defaultValue="acme"
/>
</div>
<div className="grid max-w-sm gap-4">
<Input
label="Search components"
placeholder="button, card, tabs"
leading={<Search />}
trailing={
<kbd className="rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-caption-2-regular text-muted-foreground">
⌘K
</kbd>
}
/>
<Input
label="Password"
type={visible ? "text" : "password"}
leading={<Lock />}
trailing={
<button
type="button"
onClick={() => setVisible((shown) => !shown)}
aria-label={visible ? "Hide password" : "Show password"}
className="rounded-sm p-0.5 hover:text-foreground"
>
{visible ? <EyeOff /> : <Eye />}
</button>
}
/>
</div>
<div className="grid max-w-sm gap-4">
<Input
label="Email"
error="Enter an email address, like you@company.com."
defaultValue="ada@"
/>
<Input label="Email" error="That address is already in use." />
</div>
<div className="flex flex-wrap items-end gap-4">
<Input label="Medium" className="w-40" defaultValue="acme" />
<Input label="Large" size="lg" className="w-40" defaultValue="acme" />
<Input label="Disabled" className="w-40" disabled defaultValue="acme" />
<Input label="Read only" readOnly className="w-40" defaultValue="acme" />
</div>
</div>
);
}Install
Adds the component, its registry dependencies, and the token stylesheet you import once.
Usage
import { Input } from "@/components/forme/input/input";
<Input label="Email" type="email" description="We send the receipt here." />When to use
Reach for it
- A single line of text, with its label, its help text and its error in one component.
Use something else
- Several lines of text; use a
Textarea. - A one-time code split into boxes; that is the
OtpInput.
API reference
Read from the source, so it is the API of the file you install. A prop marked * is required.
Input
| Prop | Type | Default | Description |
|---|---|---|---|
label* | string | — | Visible label. Required rather than optional: an unlabelled field is a mystery to anyone using a screen reader, and a placeholder is not a label. |
description | ReactNode | — | Help text under the field. Replaced by error when there is one. |
error | string | — | Marks the field invalid and is announced as soon as it appears. |
leading | ReactNode | — | Sits inside the field before the text. Decorative and unclickable, so it is hidden from assistive technology; use trailing for anything a person has to reach. |
trailing | ReactNode | — | Sits inside the field after the text. Buttons are allowed. |
size | 'md' | 'lg' | "md" |
Also takes every prop of <input> attributes.
Accessibility
labelis required, and the help text and error are tied to the field witharia-describedby.- An
errorsetsaria-invalidand is announced as an alert.
Related


Calendar
A month grid for a single date or a range, with no date library. Full WAI-ARIA keyboard support, min, max and disabled days, a range that previews under the pointer, and a fixed six-week height so nothing below it jumps.
inputs

File Dropzone
A drop target that is also a real file picker, so click, keyboard and drag all work. Checks type and size on drop as well as in the picker, and reports each rejected file by name.
inputs

Multi Select
Choose several options from a long list: removable chips you can type into to filter, over a list where each option toggles. Groups, a max with a counter, Backspace and arrow keys through the chips, and plain form submission — on Base UI's Combobox.
inputs