Get the FREE Ultimate OpenClaw Setup Guide →

ink

Scanned
npx machina-cli add skill georg-unterholzner/ink-skill/ink --openclaw
Files (1)
SKILL.md
3.1 KB

Ink - React for CLIs

React for CLIs. Build and test your CLI output using components.

Ink provides the same component-based UI building experience that React offers in the browser, but for command-line apps. It uses Yoga for Flexbox layouts in the terminal.

Important: All text must be wrapped in a <Text> component.

Quick Example

import {render, Text, Box} from 'ink';

render(
	<Box borderStyle="round" padding={1}>
		<Text color="green">Hello World</Text>
	</Box>
);

Components

  • <Text> - Display text with styling (color, bold, italic, underline, etc.)
  • <Box> - Flexbox container for layouts
  • <Newline> - Insert newline characters
  • <Spacer> - Flexible space that expands to fill available space
  • <Static> - Permanently render output above everything else (for logs, completed tasks)
  • <Transform> - Transform string representation before output

Hooks

Interaction

Lifecycle & Streams

Accessibility

API

Guides

Third-Party Components

See references/third-party.md for a comprehensive list of community components including:

  • Text inputs, spinners, select menus
  • Progress bars, tables, charts
  • Markdown rendering, syntax highlighting
  • And many more

Source

git clone https://github.com/georg-unterholzner/ink-skill/blob/main/ink/SKILL.mdView on GitHub

Overview

Ink lets you build interactive terminal UIs using React components. It brings React-style layout and styling to the command line, powered by Yoga for flexbox, and requires all text to be wrapped in a Text component for consistent styling and accessibility.

How This Skill Works

Code your UI with components like Box for layout and Text for styling; Ink renders your tree to the terminal via render. It exposes hooks such as useInput, useFocus, and useApp to handle keyboard input, focus management, and lifecycle events, enabling dynamic and accessible CLIs.

When to Use It

  • Create interactive CLI tools with menus and keyboard navigation
  • Design complex, responsive terminal layouts using Box and Text
  • Build live-updating dashboards or log viewers in the terminal
  • Develop accessible CLIs that work with screen readers
  • Prototype and test UIs with ink-testing-library

Quick Start

  1. Step 1: Install Ink with npm i ink
  2. Step 2: Create a component using Box and Text and render it with render
  3. Step 3: Add interactivity using useInput and useFocus, then run your CLI

Best Practices

  • Always wrap text in the Text component
  • Use Box for flex layouts powered by Yoga for predictable terminal layouts
  • Leverage useInput to respond to keyboard input and implement shortcuts
  • Use useFocus and useFocusManager to control focus order
  • Use Static for persistent logs or important output above other content

Example Use Cases

  • Interactive installer wizard with step-by-step prompts
  • Live monitoring dashboard showing real-time stats
  • Keyboard-navigable settings menu for CLI apps
  • Styled log viewer with colors and borders
  • Progress indicators and spinners inside a textual UI

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers