Input
since v0.1.0Single-line text field — use for all form data entry outside of multi-line content.
Install
Add the package and import the component.
pnpm add @hey-mike/tungstenpnpm add @hey-mike/tungstenimport { Input } from '@hey-mike/tungsten';import { Input } from '@hey-mike/tungsten';Preview
Same fixtures used by the visual-regression suite.
Usage
apps/docs/app/snapshots/input/page.tsx
import { Input } from '@hey-mike/tungsten';
import { VariantGrid } from '../_components/VariantGrid';
export default function InputSnapshot() {
return (
<VariantGrid
title="Input"
variants={[
{ label: 'empty', node: <Input placeholder="Type something…" /> },
{ label: 'filled', node: <Input defaultValue="Hello world" /> },
{ label: 'disabled', node: <Input defaultValue="Disabled value" disabled /> },
{ label: 'readonly', node: <Input defaultValue="Read-only value" readOnly /> },
]}
/>
);
}
import { Input } from '@hey-mike/tungsten';
import { VariantGrid } from '../_components/VariantGrid';
export default function InputSnapshot() {
return (
<VariantGrid
title="Input"
variants={[
{ label: 'empty', node: <Input placeholder="Type something…" /> },
{ label: 'filled', node: <Input defaultValue="Hello world" /> },
{ label: 'disabled', node: <Input defaultValue="Disabled value" disabled /> },
{ label: 'readonly', node: <Input defaultValue="Read-only value" readOnly /> },
]}
/>
);
}
Props
Surface specific to <Input />.
| Prop | Type | Default | Description |
|---|---|---|---|
| label | string | — | Inline label. Omit when wrapping in a <FormField>. |
| error | string | — | Error message; switches focus voltage to error palette. |
| hint | string | — | Help text shown below the input. Suppressed when error is set. |
| type | "number" | "text" | "email" | "password" | "tel" | "url" | "search" | "date" | "time" | "datetime-local" | "month" | "week" | — | HTML input type. type="checkbox" is intentionally excluded. |
Used in recipes
Compositions from the /recipes reference that use this component.
- →
Login form
Minimal email + password sign-in form built on FormProvider + FormField. Email is required and format-checked; the submit handler only fires onValid when both fields pass.
- →
Multi-step wizard
A two-step wizard sharing one FormProvider across steps. Step navigation is local recipe state; field values and validation stay owned by FormProvider — the thin layer is not extended for step state. Per-step Next validates only that step’s fields before advancing.
- →
Profile edit form
Pre-filled profile form using FormProvider defaultValues, mixing Input, Select, and Textarea controls — all wired through FormField with no per-control glue.
- →
Settings form
Account settings panel grouping several FormFields with help text under section headings. Shows FormField composing labelled controls in a denser, sectioned layout.
- →
Signup form
Account creation form demonstrating cross-field validation: the confirm-password field is checked against password via FormProvider’s form-level validate(values).