Utility
Terminal
Installation
$ pnpm dlx shadcn@latest add @termcn/ink/number-input
Usage
import { NumberInput } from "@/components/ui/number-input";<NumberInput
label="Quantity"
min={0}
max={100}
step={1}
onChange={(value) => console.log("Value:", value)}
/>API Reference
NumberInput
| Prop | Type | Default |
|---|---|---|
value | number | - |
onChange | (value: number) => void | - |
onSubmit | (value: number) => void | - |
min | number | - |
max | number | - |
step | number | 1 |
placeholder | string | "" |
label | string | - |
id | string | - |
format | (n: number) => string | - |
borderStyle | "single" | "double" | "round" | "bold" | "singleDouble" | "doubleSingle" | "classic" | "round" |
paddingX | number | 1 |
cursor | string | "█" |
stepHint | string | "↑ +{step} ↓ -{step}" |
Notes
Accessibility
termcn exposes the following behavior through Ink's terminal accessibility APIs. This is not a browser ARIA or general WCAG-conformance claim.
- Keyboard:
Left/Rightmove by grapheme,Home/Endmove to the boundaries, andBackspace/Deleteremove one complete grapheme.Entersubmits or confirms (Ctrl+Enterin TextArea);Tab/Shift+Tableave through Ink focus traversal. - Focus and composition: Input is active only while the component's focus target is focused, enabled, active, and inside the topmost focus scope.
- Screen reader: Ink labels and semantic state expose the component without relying on visual styling alone.