ComponentsConfirmInput
ConfirmInput
stableInline y/n confirmation prompt with configurable default answer.
Browser preview is a simulation. The copied component runs in actual terminal apps.
confirm-input.tsx
Overwrite existing file?[Y/n]
Delete 3 files?[y/N]
confirm-input.tsx
Installation
npx orizen-tui@latest add confirm-input
if dependency install fails, run: npm install ink@^5.0.1 react@^18.3.1 @types/react@^18.3.18 orizen-tui-core@latest
- Copy and paste the following code into your project.
- Update import paths to match your project setup.
components/ui/orizen/confirm-input.tsx
Usage
confirm-input.imports.tsx
confirm-input.example.tsx
Examples
Usage
confirm-input.example1.tsx
Overwrite existing file?[Y/n]
Delete 3 files?[y/N]
confirm-input.example1.tsx
API Reference
ConfirmInput
PropTypeDefaultDescription
messagestring-Question shown to the user
message-
stringQuestion shown to the user
defaultAnswer'yes' | 'no''yes'Pre-selected answer (shown capitalized)
defaultAnswer'yes'
'yes' | 'no'Pre-selected answer (shown capitalized)
onConfirm(answer: boolean) => void-Called when user confirms (optional)
onConfirm-
(answer: boolean) => voidCalled when user confirms (optional)
focusbooleantrueWhether input accepts keyboard events
focustrue
booleanWhether input accepts keyboard events