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/components/box.md
View on GitHub# `<Box>` Component
Essential layout container. Works like `<div style="display: flex">` in the browser.
## Import
```jsx
import {Box} from 'ink';
```
## Basic Usage
```jsx
<Box margin={2}>
<Text>Content with margin</Text>
</Box>
```
## Dimensions
### width / height
Type: `number | string`
Fixed size in spaces (columns/rows), or percentage of parent:
```jsx
<Box width={40} height={10}>...</Box>
<Box width="50%">...</Box>
```
### minWidth / minHeight
Type: `number` (minWidth) | `number | string` (minHeight)
```jsx
<Box minWidth={20} minHeight={5}>...</Box>
<Box minHeight="50%">...</Box>
```
**Note:** `minWidth` does not support percentages (Yoga limitation).
### maxWidth / maxHeight
Type: `number` (maxWidth) | `number | string` (maxHeight)
```jsx
<Box maxWidth={80} maxHeight={20}>...</Box>
<Box maxHeight="50%">...</Box>
```
**Note:** `maxWidth` does not support percentages (Yoga limitation).
## Padding
All padding props: Type `number`, Default `0`.
```jsx
<Box padding={2}>...</Box> // All sides
<Box paddingX={2}>...</Box> // Left + right
<Box paddingY={1}>...</Box> // Top + bottom
<Box paddingTop={1} paddingBottom={2}>...</Box> // Individual
<Box paddingLeft={2} paddingRight={2}>...</Box>
```
## Margin
All margin props: Type `number`, Default `0`.
```jsx
<Box margin={2}>...</Box> // All sides
<Box marginX={2}>...</Box> // Left + right
<Box marginY={1}>...</Box> // Top + bottom
<Box marginTop={1} marginBottom={2}>...</Box> // Individual
```
## Gap
### gap
Type: `number` | Default: `0`
Space between children (shorthand for `columnGap` and `rowGap`):
```jsx
<Box gap={1} width={3} flexWrap="wrap">
<Text>A</Text>
<Text>B</Text>
<Text>C</Text>
</Box>
// A B
//
// C
```
### columnGap / rowGap
Type: `number` | Default: `0`
```jsx
<Box columnGap={1}>
<Text>A</Text>
<Text>B</Text>
</Box>
// A B
```
## Flex
### flexDirection
Type: `string` | Allowed: `'row'` `'row-reverse'` `'column'` `'column-reverse'`
```jsx
<Box flexDirection="column">
<Text>Top</Text>
<Text>Bottom</Text>
</Box>
```
### flexGrow / flexShrink / flexBasis
```jsx
<Box>
<Text>Label:</Text>
<Box flexGrow={1}><Text>Fills remaining space</Text></Box>
</Box>
```
### flexWrap
Type: `string` | Allowed: `'nowrap'` `'wrap'` `'wrap-reverse'`
### alignItems
Type: `string` | Allowed: `'flex-start'` `'center'` `'flex-end'`
### alignSelf
Type: `string` | Default: `'auto'` | Allowed: `'auto'` `'flex-start'` `'center'` `'flex-end'`
### justifyContent
Type: `string` | Allowed: `'flex-start'` `'center'` `'flex-end'` `'space-between'` `'space-around'` `'space-evenly'`
See [Layout Reference](../layout/REFERENCE.md) for detailed flex examples.
## Display
### display
Type: `string` | Allowed: `'flex'` `'none'` | Default: `'flex'`
Hide elements with `display="none"`.
## Overflow
### overflow / overflowX / overflowY
Type: `string` | Allowed: `'visible'` `'hidden'` | Default: `'visible'`
```jsx
<Box overflow="hidden" width={10} height={3}>
<Text>Content that might be too long</Text>
</Box>
```
## Borders
### borderStyle
Type: `string | BoxStyle` | Allowed: `'single'` `'double'` `'round'` `'bold'` `'singleDouble'` `'doubleSingle'` `'classic'`
```jsx
<Box borderStyle="round">
<Text>Rounded box</Text>
</Box>
```
Custom border style:
```jsx
<Box borderStyle={{
topLeft: '↘', top: '↓', topRight: '↙',
left: '→', bottomLeft: '↗', bottom: '↑',
bottomRight: '↖', right: '←'
}}>
<Text>Custom</Text>
</Box>
```
### borderColor
Type: `string`
Shorthand for all border sides:
```jsx
<Box borderStyle="round" borderColor="green">
<Text>Green border</Text>
</Box>
```
Individual: `borderTopColor`, `borderRightColor`, `borderBottomColor`, `borderLeftColor`
### borderDimColor
Type: `boolean` | Default: `false`
Dim the border color. Individual: `borderTopDimColor`, `borderBottomDimColor`, `borderLeftDimColor`, `borderRightDimColor`
### Border Visibility
`borderTop`, `borderRight`, `borderBottom`, `borderLeft`: Type `boolean`, Default `true`
Show/hide individual border sides:
```jsx
<Box borderStyle="single" borderBottom={false}>
<Text>No bottom border</Text>
</Box>
```
## Background
### backgroundColor
Type: `string`
Background color fills the entire `<Box>` area. Inherited by child `<Text>` unless they override:
```jsx
<Box backgroundColor="blue" alignSelf="flex-start">
<Text>Blue inherited </Text>
<Text backgroundColor="yellow">Yellow override </Text>
<Text>Blue inherited again</Text>
</Box>
```
Works with borders and padding:
```jsx
<Box backgroundColor="cyan" borderStyle="round" padding={1} alignSelf="flex-start">
<Text>Background with border and padding</Text>
</Box>
```
## See Also
- [Text](./text.md) - Text display component
- [Layout](../layout/REFERENCE.md) - Flexbox layout system
- [Layout Patterns](../layout/patterns.md) - Common layout recipes
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 |