Input
A field for entering short text, numbers, or other data.
- Status
- Ready
- Code
- In React
- Role
- Form
Usage
This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.
We send the receipt here.
Pastes as editable layers. Shadows are not exported.
import { useState, type ChangeEvent } from "react";
import { Input } from "@/ui";
const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
export default function InputDemo() {
const [email, setEmail] = useState<string>("");
const [touched, setTouched] = useState<boolean>(false);
const invalid: boolean = touched && !EMAIL.test(email);
return (
<Input
label="Email"
type="email"
value={email}
placeholder="email@example.com"
onChange={(e: ChangeEvent<HTMLInputElement>) => setEmail(e.target.value)}
onBlur={() => setTouched(true)}
hint="We send the receipt here."
error={invalid ? "Enter a valid email address." : undefined}
/>
);
}Variants and states
Every specimen is the real component from src/ui, held in one state.
We only call about this order.
Enter a valid email address.
Pastes as editable layers. Shadows are not exported.
Props
- label
- string · default none
- Required visible label, connected to the field.
- hint
- string · default none
- Helper text under the field.
- error
- string · default none
- Marks the field invalid, sets aria-invalid, and replaces the hint.
- className
- string · default ""
- Extra classes for the input element itself, not the wrapper around label, field, and note.
- ...rest
- InputHTMLAttributes · default none
- Every other native input attribute, such as type, value, placeholder, disabled, and required. Not id, which is generated. They are spread last, so an aria-describedby you pass replaces the link to the hint or error.
Figma to code
Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.
- 🖍 Label
- label
- Required in code.
- 🖊 Show Label
- None
- No prop. The label is always shown, because a placeholder is not a label.
- 🩹 Helper Text
- hint, error
- hint is the help line. error is the validation line, and it replaces the hint while it is set.
- 🩹 Show Helper Text
- None
- No prop. Pass hint to show the line, or leave it out.
- 🔤 Placeholder
- placeholder
- The native attribute, passed through ...rest.
- 🎯 State
- error, disabled
- Error is the error prop and disabled is the native attribute. Hover and focus come from the browser at runtime.
- 📐 Size
- None
- No prop yet. Input has one size, at least 44px tall.
- ☘️ Icon
- None
- No prop yet. Input has no icon slot.
Accessibility
What the code in src/ui does today, and what it leaves to you.
Keyboard
- A native input: Tab focuses it, and typing and editing keys work as usual.
- A disabled field uses the native disabled attribute, so Tab skips it.
- The component draws its own focus ring: 2px in the border/focus role, or the border/danger role while there is an error.
Screen readers
- The label is linked with for and a generated id, so it is the field's accessible name. Clicking the label focuses the field.
- The hint, or the error when there is one, is linked with aria-describedby and read after the name.
- error sets aria-invalid="true", so the field is announced as invalid.
- The error line is not a live region. It is read when the field gets focus, not at the moment it appears.
What you still need to do
- On submit, move focus to the first invalid field or to an error summary, because a new error is not announced.
- Mark a required field in the label text, and pass required for the native check. The component has no required indicator.
- Leave aria-describedby alone unless you mean to replace the hint and error link.
When to use
Single-line text entry in forms.
Do and don't
Do
- Always pair with a visible label.
- Show inline validation errors close to the field.
Don't
- Use placeholder text as a substitute for a label.
- Disable a field without explaining why.
Related
4 of 28 other molecules, same role and ready ones first.
- Amount InputAn input for money that formats the value as the user types.Ready
- ComboboxAn input that suggests matching options as the user types.Ready
- Date PickerChooses a date from a calendar or by typing.Ready
- File InputLets people choose or drop a file to upload.Ready
Status reflects the component tracker snapshot of 29 October 2026.