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/accessibility/REFERENCE.md
View on GitHub# Accessibility
Ink supports screen readers via the Ink Screen Reader project. When enabled, Ink renders output compatible with assistive technologies.
## Enabling Screen Reader Support
### Environment Variable
```bash
INK_SCREEN_READER=true my-cli-app
```
### Render Option
```jsx
render(<MyApp />, {isScreenReaderEnabled: true});
```
### Check From Components
```jsx
import {useIsScreenReaderEnabled} from 'ink';
const App = () => {
const isEnabled = useIsScreenReaderEnabled();
// Adapt UI for screen readers if needed
};
```
## ARIA Roles
Announce the purpose of a `<Box>` to screen readers:
```jsx
<Box aria-role="status">
<Text>3 tasks remaining</Text>
</Box>
<Box aria-role="alert">
<Text color="red">Error: Connection failed</Text>
</Box>
```
### Supported Roles
| Role | Description |
|------|-------------|
| `status` | Live region with polite updates |
| `alert` | Live region with assertive (immediate) updates |
| `timer` | Ticking timer |
| `progressbar` | Progress indication |
| `img` | Image (use with `aria-label` for description) |
| `checkbox` | Toggle control |
| `radiogroup` | Group of radio buttons |
| `radiobutton` | Single radio option |
| `button` | Clickable action |
| `textbox` | Text input |
| `listbox` | List of options |
| `option` | Option within a listbox |
| `none` | Remove semantic meaning |
## ARIA Properties
### aria-label
Human-readable label, overrides visible text:
```jsx
<Box aria-role="img" aria-label="Company logo">
<Text>{'π’'}</Text>
</Box>
<Box aria-role="button" aria-label="Submit form">
<Text>[Submit]</Text>
</Box>
```
### aria-live
How updates are announced:
```jsx
<Box aria-live="polite">
{/* Announced when screen reader is idle */}
<Text>{statusMessage}</Text>
</Box>
<Box aria-live="assertive">
{/* Announced immediately, interrupting */}
<Text color="red">{errorMessage}</Text>
</Box>
<Box aria-live="off">
{/* Not announced */}
</Box>
```
### aria-checked
For checkbox/radio components:
```jsx
<Box aria-role="checkbox" aria-checked={isChecked}>
<Text>{isChecked ? '[x]' : '[ ]'} Accept terms</Text>
</Box>
```
Supported values: `true`, `false`, `'mixed'`
### aria-selected
For listbox options:
```jsx
<Box aria-role="listbox">
{items.map(item => (
<Box
key={item.id}
aria-role="option"
aria-selected={item.id === selectedId}
>
<Text>{item.label}</Text>
</Box>
))}
</Box>
```
### aria-disabled
Mark elements as non-interactive:
```jsx
<Box aria-role="button" aria-disabled>
<Text dimColor>[Disabled]</Text>
</Box>
```
### aria-expanded
For expandable/collapsible sections:
```jsx
<Box aria-role="button" aria-expanded={isOpen}>
<Text>{isOpen ? 'βΌ' : 'βΆ'} Details</Text>
</Box>
```
### aria-valuemin / aria-valuemax / aria-valuenow / aria-valuetext
For progress bars:
```jsx
<Box
aria-role="progressbar"
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={progress}
aria-valuetext={`${progress}% complete`}
>
<Text>{'β'.repeat(progress / 5)}{'β'.repeat(20 - progress / 5)}</Text>
</Box>
```
### aria-hidden
Hide from screen readers:
```jsx
<Box aria-hidden>
<Text>Decorative border βββββββ</Text>
</Box>
```
## Patterns
### Accessible Checkbox List
```jsx
const CheckboxList = ({items, selected, onToggle}) => (
<Box flexDirection="column" aria-role="group" aria-label="Options">
{items.map(item => (
<Box key={item.id} aria-role="checkbox" aria-checked={selected.has(item.id)}>
<Text>
{selected.has(item.id) ? '[x]' : '[ ]'} {item.label}
</Text>
</Box>
))}
</Box>
);
```
### Accessible Select Menu
```jsx
const SelectMenu = ({items, selectedIndex}) => (
<Box flexDirection="column" aria-role="listbox" aria-label="Menu">
{items.map((item, i) => (
<Box
key={item}
aria-role="option"
aria-selected={i === selectedIndex}
>
<Text color={i === selectedIndex ? 'green' : undefined}>
{i === selectedIndex ? '> ' : ' '}{item}
</Text>
</Box>
))}
</Box>
);
```
### Accessible Progress Bar
```jsx
const AccessibleProgress = ({label, percent}) => (
<Box
aria-role="progressbar"
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={Math.round(percent * 100)}
aria-valuetext={`${label}: ${Math.round(percent * 100)}%`}
>
<Text>{label}: </Text>
<Text color="green">{'β'.repeat(Math.round(20 * percent))}</Text>
<Text dimColor>{'β'.repeat(20 - Math.round(20 * percent))}</Text>
<Text> {Math.round(percent * 100)}%</Text>
</Box>
);
```
### Status Announcements
```jsx
const StatusBar = ({message, type}) => (
<Box aria-role={type === 'error' ? 'alert' : 'status'} aria-live={type === 'error' ? 'assertive' : 'polite'}>
<Text color={type === 'error' ? 'red' : 'green'}>
{type === 'error' ? 'β' : 'β'} {message}
</Text>
</Box>
);
```
## Best Practices
1. **Use semantic roles** β helps screen readers understand UI structure
2. **Provide `aria-label`** for decorative or icon-only elements
3. **Use `aria-live`** for dynamic content that updates
4. **Use `aria-hidden`** for decorative elements (borders, separators)
5. **Test with screen reader mode** β set `INK_SCREEN_READER=true` during development
## See Also
- [Focus](../hooks/focus.md) - useFocus, useFocusManager
- [Configuration](../core/configuration.md) - isScreenReaderEnabled option
- [Box](../components/box.md) - Box component (accepts ARIA props)
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 |