Themes
- Default
- Catppuccin
- Dracula
- High Contrast
- High Contrast Light
- Monokai
- Nord
- One Dark
- Solarized
- Tokyo Night
- AMOLED
- Aura
- Ayu
- Carbonfox
- Catppuccin Frappe
- Catppuccin Macchiato
- Cobalt2
- Cursor
- Everforest
- Flexoki
- GitHub
- Gruvbox
- Kanagawa
- Lucent Orng
- Material
- Matrix
- Mercury
- Night Owl
- OC-2
- One Dark Pro
- OpenCode
- Orng
- Osaka Jade
- Palenight
- Rose Pine
- Shades of Purple
- Synthwave '84
- Vercel
- Vesper
- Zenburn
Utility
AI
Terminal
Installation
$ pnpm dlx shadcn@latest add @termcn/text-input
Usage
import { TextInput } from "@/components/ui/text-input";<TextInput
label="Project Name"
placeholder="my-project"
onSubmit={(value) => console.log("Name:", value)}
/>Examples
Placeholder
A text input with placeholder text.
Terminal
import { TextInput } from "@/components/ui/text-input";
export function TextInputPlaceholder() {
return <TextInput placeholder="Search packages..." />;
}With Label
Multiple labeled inputs stacked together.
Terminal
import { Box } from "ink";
import { TextInput } from "@/components/ui/text-input";
export function TextInputLabel() {
return (
<Box flexDirection="column" gap={1}>
<TextInput label="Name" placeholder="Enter your name" />
<TextInput label="Email" placeholder="you@example.com" />
</Box>
);
}Cursor and editing
With showCursor (default true), use the left and right arrow keys to move the insertion point; type and Backspace apply at the cursor.
Terminal
import { Box, Text } from "ink";
import { TextInput } from "@/components/ui/text-input";
export function TextInputCursor() {
return (
<Box flexDirection="column" gap={1}>
<Text dimColor>← → move cursor · type / backspace at cursor</Text>
<TextInput
autoFocus
label="Editable"
placeholder="Try arrows"
showCursor
/>
</Box>
);
}API Reference
TextInput
| Prop | Type | Default |
|---|---|---|
value | string | - |
onChange | (value: string) => void | - |
onSubmit | (value: string) => void | - |
placeholder | string | "" |
mask | string | - |
showCursor | boolean | true |
highlightPastedText | boolean | false |
validate | (value: string) => string|null | - |
width | number | 40 |
label | string | - |
autoFocus | boolean | false |
id | string | - |
bordered | boolean | true |
borderStyle | "single" | "double" | "round" | "bold" | "singleDouble" | "doubleSingle" | "classic" | "round" |
paddingX | number | 1 |
cursor | string | "█" |