ink
БесплатноБез исполняемых скриптовНе проверенInk - React for CLI applications, build interactive command-line interfaces using React components with Flexbox layout, hooks for input/focus, and testing…
Об этом скилле
Ink
Ink is a framework for building command-line interfaces using React components. It provides the same component-based UI building experience that React offers in the browser, but for command-line apps. The framework leverages Yoga, a Flexbox layout engine, enabling developers to use familiar CSS-like properties in terminal environments.
When to Use
- Building interactive CLI applications with React
- Creating terminal UIs with complex layouts
- Building progress indicators and spinners for CLI tools
- Creating multi-step wizards in the terminal
- Building dev tools with rich terminal output
- Creating dashboard-style CLI interfaces
- Handling keyboard input in terminal apps
- Building accessible CLI applications with screen reader support
- Testing terminal UI components
Adoption
Ink is used by major projects including:
- Shopify CLI
- Gatsby
- Prisma
- Google's Gemini CLI
- Cloudflare Wrangler
- Parcel
Installation
npm install ink react
For TypeScript:
npm install ink react
npm install -D @types/react
Quick Start with Template
npx create-ink-app my-ink-cli
cd my-ink-cli
npm start
Basic Usage
import React from 'react';
import {render, Text} from 'ink';
const App = () => <Text color="green">Hello, Ink!</Text>;
render(<App />);
Counter Example
import React, {useState, useEffect} from 'react';
import {render, Text} from 'ink';
const Counter = () => {
const [counter, setCounter] = useState(0);
useEffect(() => {
const timer = setInterval(() => {
setCounter(c => c + 1);
}, 100);
return () => clearInterval(timer);
}, []);
return <Text color="green">{counter} tests passed</Text>;
};
render(<Counter />);
Core Components
Text
The <Text> component handles all text rendering. Text content must be wrapped in this component.
import {Text} from 'ink';
// Basic text
<Text>Hello World</Text>
// With colors
<Text color="green">Success</Text>
<Text color="#ff0000">Error (hex)</Text>
<Text color="rgb(255, 128, 0)">Warning (rgb)</Text>
// With styles
<Text bold>Bold text</Text>
<Text italic>Italic text</Text>
<Text underline>Underlined</Text>
<Text strikethrough>Strikethrough</Text>
<Text inverse>Inverted colors</Text>
<Text dimColor>Dimmed text</Text>
// Combined styles
<Text bold color="cyan" backgroundColor="blue">
Styled text
</Text>
Text Props
| Prop | Type | Default | Description |
|---|---|---|---|
color |
string | - | Text color (named, hex, rgb) |
backgroundColor |
string | - | Background color |
dimColor |
boolean | false | Dim the color |
bold |
boolean | false | Bold text |
italic |
boolean | false | Italic text |
underline |
boolean | false | Underlined text |
strikethrough |
boolean | false | Strikethrough text |
inverse |
boolean | false | Swap foreground/background |
wrap |
string | "wrap" | Text wrapping mode |
Wrap modes:
wrap- Wrap text (default)truncate/truncate-end- Truncate at end with ellipsistruncate-start- Truncate at starttruncate-middle- Truncate in middle
Box
<Box> is the primary layout component - a flexbox container for organizing UI elements.
import {Box, Text} from 'ink';
// Basic layout
<Box>
<Text>Left</Text>
<Text>Right</Text>
</Box>
// Column layout
<Box flexDirection="column">
<Text>Top</Text>
<Text>Bottom</Text>
</Box>
// With padding and margin
<Box padding={2} margin={1}>
<Text>Padded content</Text>
</Box>
// With border
<Box borderStyle="round" borderColor="green" padding={1}>
<Text>Bordered box</Text>
</Box>
// Centered content
<Box justifyContent="center" alignItems="center" height={10}>
<Text>Centered</Text>
</Box>
Box Props - Dimensions
| Prop | Type | Description |
|---|---|---|
width |
number | string | Width in spaces or percentage |
height |
number | string | Height in lines or percentage |
minWidth |
number | Minimum width |
minHeight |
number | Minimum height |
Box Props - Padding
| Prop | Type | Description |
|---|---|---|
padding |
number | All sides |
paddingX |
number | Left and right |
paddingY |
number | Top and bottom |
paddingTop |
number | Top only |
paddingBottom |
number | Bottom only |
paddingLeft |
number | Left only |
paddingRight |
number | Right only |
Box Props - Margin
| Prop | Type | Description |
|---|---|---|
margin |
number | All sides |
marginX |
number | Left and right |
marginY |
number | Top and bottom |
marginTop |
number | Top only |
marginBottom |
number | Bottom only |
marginLeft |
number | Left only |
marginRight |
number | Right only |
Box Props - Flexbox
| Prop | Type | Default | Description |
|---|---|---|---|
flexDirection |
string | "row" | row, row-reverse, co |
Установить ink в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл ink?
Ink - React for CLI applications, build interactive command-line interfaces using React components with Flexbox layout, hooks for input/focus, and testing support
Как установить скилл ink?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ink запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic