shadcn-labs/termcn / .agents/skills/ink
ink
VerifiedComprehensive Ink skill for building CLI applications with React. Covers components (Text, Box, Static, Transform), hooks (useInput, useApp, useFocus), Flexbox layout, testing, and accessibility.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 10.2 KB |
| references/accessibility/REFERENCE.md | markdown | 5.3 KB |
| references/components/REFERENCE.md | markdown | 1.7 KB |
| references/components/box.md | markdown | 4.9 KB |
| references/components/text.md | markdown | 2.4 KB |
| references/components/utilities.md | markdown | 3.3 KB |
| references/core/REFERENCE.md | markdown | 3.1 KB |
| references/core/api.md | markdown | 3.4 KB |
| references/core/configuration.md | markdown | 3.7 KB |
| references/core/gotchas.md | markdown | 4.6 KB |
| references/core/patterns.md | markdown | 6.7 KB |
| references/hooks/REFERENCE.md | markdown | 1.7 KB |
| references/hooks/app-lifecycle.md | markdown | 1.9 KB |
| references/hooks/focus.md | markdown | 5.2 KB |
| references/hooks/input.md | markdown | 3.7 KB |
| references/hooks/stdio.md | markdown | 3.1 KB |
| references/layout/REFERENCE.md | markdown | 4.1 KB |
| references/layout/patterns.md | markdown | 3.8 KB |
| references/testing/REFERENCE.md | markdown | 5.3 KB |
| rules/RULES.md | markdown | 1.4 KB |
| rules/components.md | markdown | 8.3 KB |
| rules/core.md | markdown | 9.0 KB |
| rules/hooks.md | markdown | 10.1 KB |
| rules/performance.md | markdown | 6.6 KB |
references/core/configuration.md
View on GitHub# Configuration
## Render Options
### stdout / stdin / stderr
Custom streams for output, input, and errors:
```jsx
render(<MyApp />, {
stdout: customWriteStream,
stdin: customReadStream,
stderr: customErrorStream,
});
```
### exitOnCtrlC
Type: `boolean` | Default: `true`
Listen for Ctrl+C and exit. Needed when stdin is in raw mode (Ctrl+C is ignored by default in raw mode).
### patchConsole
Type: `boolean` | Default: `true`
Patch `console.*` methods so output doesn't mix with Ink's output. When enabled, Ink intercepts console calls, clears main output, renders console output, then rerenders the main output.
### debug
Type: `boolean` | Default: `false`
Render each update as separate output instead of replacing previous output. Useful for debugging render cycles.
### maxFps
Type: `number` | Default: `30`
Maximum frames per second. Controls how frequently the UI can update. Lower values reduce CPU usage for frequently-updating components.
```jsx
render(<MyApp />, {maxFps: 10}); // Throttle to 10fps
```
### incrementalRendering
Type: `boolean` | Default: `false`
Only update changed lines instead of redrawing the entire output. Reduces flickering and improves performance for frequently updating UIs.
```jsx
render(<MyApp />, {incrementalRendering: true});
```
### concurrent
Type: `boolean` | Default: `false`
Enable React Concurrent Rendering mode:
- Suspense boundaries work with async data fetching
- `useTransition` and `useDeferredValue` hooks are functional
- Updates can be interrupted for higher priority work
```jsx
render(<MyApp />, {concurrent: true});
```
**Note:** The `concurrent` option only takes effect on the first render for a given stdout. Call `unmount()` first to change rendering mode.
### onRender
Type: `({renderTime: number}) => void`
Callback after each render with metrics:
```jsx
render(<MyApp />, {
onRender: ({renderTime}) => {
console.log(`Rendered in ${renderTime}ms`);
},
});
```
### isScreenReaderEnabled
Type: `boolean` | Default: `process.env['INK_SCREEN_READER'] === 'true'`
Enable screen reader support. See [Accessibility](../accessibility/REFERENCE.md).
### kittyKeyboard
Type: `object` | Default: `undefined`
Enable the kitty keyboard protocol for enhanced keyboard input.
```jsx
render(<MyApp />, {kittyKeyboard: {mode: 'auto'}});
```
#### kittyKeyboard.mode
- `'auto'`: Detect terminal support with heuristic precheck
- `'enabled'`: Force enable (stdin and stdout must be TTYs)
- `'disabled'`: Never enable
#### kittyKeyboard.flags
Default: `['disambiguateEscapeCodes']`
Available flags:
- `'disambiguateEscapeCodes'`
- `'reportEventTypes'`
- `'reportAlternateKeys'`
- `'reportAllKeysAsEscapeCodes'`
- `'reportAssociatedText'`
## CI Mode
When running on CI (detected via `CI` environment variable):
- Only the last frame is rendered on exit
- Terminal resize events are not listened to
Opt out with `CI=false`:
```bash
CI=false node my-cli.js
```
## Environment Variables
| Variable | Effect |
|----------|--------|
| `CI` | Enables CI rendering mode |
| `INK_SCREEN_READER` | Set to `'true'` to enable screen reader support |
| `DEV` | Enables React DevTools integration |
## React DevTools
Enable with `DEV=true`:
```bash
DEV=true my-cli
npx react-devtools # In another terminal
```
You can inspect and change props live.
## Project Setup
### package.json (TypeScript)
```json
{
"type": "module",
"scripts": {
"build": "tsc",
"start": "node dist/index.js"
},
"dependencies": {
"ink": "latest",
"react": "latest"
},
"devDependencies": {
"@types/react": "latest",
"typescript": "latest"
}
}
```
### Babel Setup (JavaScript)
```bash
npm install --save-dev @babel/preset-react
```
```json
{
"presets": ["@babel/preset-react"]
}
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |