| name | react-ink |
| description | Builds interactive terminal UIs with React Ink: Box and Text, Yoga flexbox, useInput, useFocus, Static logs, and create-ink-app. Use when the user wants a React CLI, Ink components, or styled stdout UI. Not for React DOM, Next.js, or React Native screens. Do not use for shell scripts that only print text. |
| version | 1.0.1 |
Overview
React Ink brings React's component model to the terminal. Instead of rendering to the DOM, Ink renders to stdout using a custom React reconciler backed by the Yoga layout engine (the same Flexbox implementation used by React Native). Build interactive CLI tools with components like <Box> for layout and <Text> for styled output, handle keyboard input with useInput, and manage focus with useFocus - all using familiar React patterns including hooks, state, effects, Suspense, and concurrent rendering.
When to Use
Trigger this skill when the user:
- Wants to build an interactive CLI application using React
- Needs terminal UI components with Flexbox layout (Box, Text)
- Is handling keyboard input in a terminal app with
useInput
- Wants focus management across terminal UI elements
- Needs to display progress, spinners, or streaming logs in a CLI
- Is scaffolding a new CLI project with
create-ink-app
- Wants to render styled text with colors, borders, or formatting in the terminal
Do NOT trigger this skill for:
- General React web or React Native development (use frontend-developer)
- Simple shell scripts that just print output (use shell-scripting)
Prerequisites
- Node >= 20
- React >= 19
- Ink v6+ is ESM-only (
"type": "module" in package.json)
- Windows host is primary (PowerShell). Commands provided are compatible with PowerShell unless noted.
Procedure
-
Install Ink and React
npm install ink react
Or scaffold a full project:
npx create-ink-app my-cli
npx create-ink-app my-cli --typescript
-
Create a basic app
import React, {useState, useEffect} from 'react';
import {render, Text} from 'ink';
function Counter() {
const [count, setCount] = useState(0);
useEffect(() => {
const timer = setInterval(() => {
setCount(prev => prev + 1);
}, 100);
return () => clearInterval(timer);
}, []);
return <Text color="green">{count} tests passed</Text>;
}
render(<Counter />);
-
Render an app and handle exit
import {render, useApp, useInput, Text} from 'ink';
function App() {
{exit} = ();
( {
(input === ) ();
});
;
}
instance = ();
instance.();
.();
Pitfalls
-
Raw text inside <Box> silently breaks rendering - Placing a string directly inside <Box> without wrapping it in <Text> causes a runtime error. Unlike web React where a <div> can contain bare text, Ink enforces that only <Text> components hold text content. Always wrap strings in <Text>.
-
useInput does nothing without raw mode on stdin - If stdin is not in raw mode (e.g., piped input in CI, non-TTY environments), useInput never fires. Check useStdin().isRawModeSupported before relying on keyboard input, and provide a non-interactive fallback for CI/piped contexts.
-
Ink v6 is ESM-only and breaks CommonJS imports - Importing Ink with require('ink') throws require() of ES Module. You must use import syntax and set "type": "module" in your package.json. This also means Ink v6 cannot be used in projects that are stuck on CommonJS without a build step.
-
<Static> items must have stable keys or they re-render - The <Static> component renders each item exactly once and never updates it. If you pass items without stable key props or if you mutate the items array in place instead of appending, previously rendered lines can disappear or duplicate.
-
The app stays alive as long as stdin listeners or timers exist - Ink's render() keeps the process running while there are pending timers, promises, or stdin listeners. Forgetting to call clearInterval, clearTimeout, or exit() from useApp() results in a CLI tool that hangs after the work is done.
-
stdin.setRawMode is not a function - Running in non-TTY environment (piped input, CI). Check isRawModeSupported from useStdin() before enabling.
-
React is not defined - Missing React import with JSX transform. Add import React from 'react' or configure JSX automatic runtime.
Verification
- Check Node version:
node -v (must be >= 20)
- Check package.json for
"type": "module" if using Ink v6+
- Run the CLI app:
node dist/index.js or npm start
- Verify interactive input works in a real terminal (not piped)
- Verify the process exits cleanly after completion (no hanging)
- Verify no raw text is placed directly inside
<Box> components
UI/UX 2026 Guidelines
This skill also covers interface design, UX review, accessibility, responsive layouts, design systems, mobile/web UI, component behavior, interaction states, visual hierarchy, usability improvements, and frontend implementation guidance.
Workflow:
- Start from the user task and information architecture, not decoration.
- Map key states: empty, loading, success, error, disabled, permission-limited, offline, and responsive variants.
- Apply accessibility requirements early: keyboard flow, focus visibility, labels, contrast, reduced motion, touch targets, text resizing, and semantic structure.
- Use design-system primitives where available; otherwise define tokens for spacing, color, type, elevation, radius, and motion.
- Design responsive layouts with stable dimensions and no text overlap across desktop and mobile.
- Validate with realistic content, long labels, error text, and touch/keyboard interaction.
- Deliver concrete implementation guidance, not vague aesthetic notes.
Quality Checklist:
- User can complete the core task quickly and repeatedly.
- UI supports keyboard, screen readers, visible focus, and sufficient contrast.
- Mobile and desktop layouts do not overlap or rely on fragile viewport-scaled text.
- Controls use familiar affordances and expose state clearly.
- Motion is purposeful and respects reduced-motion preferences.
- Visual direction is intentional and consistent with the product domain.
Failure Handling:
If requirements conflict, prioritize usability, accessibility, and product fit over novelty. If a requested visual pattern harms readability or accessibility, explain the tradeoff and offer a better variant. Verify current platform guidance when building for Apple, Android, or a specific design system.
Current References:
References
This skill does not ship a companion pack. Box/Text/hooks usage is in Procedure above. Full props, community components, and example apps:
Related skills
- frontend-developer: For general React web or React Native development.
- shell-scripting: For simple shell scripts that just print output.