| title | Input Components |
|---|
Single-line input with placeholder, validation, and optional masking.
Props:
| Prop | Type | Default | Required |
|---|---|---|---|
value |
string |
— |
✓ |
onChange |
(value: string) => void |
— |
✓ |
onSubmit |
(value: string) => void |
— |
— |
placeholder |
string |
— |
— |
mask |
string |
— |
— |
focus |
boolean |
— |
— |
validate |
`(value: string) => string | null` | — |
Usage:
import { TextInput } from 'termui/components';
const [value, setValue] = useState('');
<TextInput
value={value}
onChange={setValue}
onSubmit={(v) => console.log(v)}
placeholder="Enter name..."
/>;Multi-line text editor with scrolling and line wrapping.
Props:
| Prop | Type | Default | Required |
|---|---|---|---|
value |
string |
— |
✓ |
onChange |
(value: string) => void |
— |
✓ |
placeholder |
string |
— |
— |
rows |
number |
5 |
— |
focus |
boolean |
— |
— |
Usage:
import { TextArea } from 'termui/components';
<TextArea value={text} onChange={setText} placeholder="Write here..." rows={6} />;Masked password input with reveal toggle.
Props:
| Prop | Type | Default | Required |
|---|---|---|---|
value |
string |
— |
✓ |
onChange |
(value: string) => void |
— |
✓ |
onSubmit |
(value: string) => void |
— |
— |
placeholder |
string |
'Password...' |
— |
mask |
string |
'•' |
— |
showToggle |
boolean |
true |
— |
Usage:
import { PasswordInput } from 'termui/components';
<PasswordInput value={pass} onChange={setPass} placeholder="Enter password..." />;Numeric input with ↑↓ increment/decrement and min/max clamping.
Props:
| Prop | Type | Default | Required |
|---|---|---|---|
value |
number |
— |
✓ |
onChange |
(value: number) => void |
— |
✓ |
min |
number |
— |
— |
max |
number |
— |
— |
step |
number |
1 |
— |
Usage:
import { NumberInput } from 'termui/components';
<NumberInput value={count} onChange={setCount} min={0} max={100} />;Fuzzy-search input with autocomplete dropdown.
Props:
| Prop | Type | Default | Required |
|---|---|---|---|
value |
string |
— |
✓ |
onChange |
(value: string) => void |
— |
✓ |
onSelect |
(item: string) => void |
— |
— |
options |
string[] |
— |
✓ |
placeholder |
string |
— |
— |
maxResults |
number |
5 |
— |
Usage:
import { SearchInput } from 'termui/components';
<SearchInput
value={query}
onChange={setQuery}
onSelect={handleSelect}
options={['Apple', 'Banana', 'Cherry']}
/>;Format-constrained input for phone, date, credit card patterns.
Props:
| Prop | Type | Default | Required |
|---|---|---|---|
value |
string |
— |
✓ |
onChange |
(value: string) => void |
— |
✓ |
mask |
string |
— |
✓ |
placeholder |
string |
— |
— |
Usage:
import { MaskedInput } from 'termui/components';
<MaskedInput value={phone} onChange={setPhone} mask="(999) 999-9999" />;Email input with domain autocomplete and inline validation.
Props:
| Prop | Type | Default | Required |
|---|---|---|---|
value |
string |
— |
✓ |
onChange |
(value: string) => void |
— |
✓ |
onSubmit |
(value: string) => void |
— |
— |
suggestions |
string[] |
['gmail.com', 'yahoo.com', ...] |
— |
Usage:
import { EmailInput } from 'termui/components';
<EmailInput value={email} onChange={setEmail} onSubmit={handleSubmit} />;Filesystem path input with Tab autocomplete.
Props:
| Prop | Type | Default | Required |
|---|---|---|---|
value |
string |
— |
✓ |
onChange |
(value: string) => void |
— |
✓ |
onSubmit |
(value: string) => void |
— |
— |
cwd |
string |
process.cwd() |
— |
showHidden |
boolean |
false |
— |
Usage:
import { PathInput } from 'termui/components';
<PathInput value={path} onChange={setPath} onSubmit={handleSubmit} />;