docs: add usePaste/useBoxMetrics/useCursor/useAnimation to README composables

The composables table was missing four exported composables. Add them
and note that `useTerminalSize` is also exported under Ink's
`useWindowSize` name.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yunfei He
2026-06-08 19:55:17 +08:00
parent c75c6497d4
commit 7451cd4cd6
+6 -2
View File
@@ -112,15 +112,19 @@ useInput((input) => {
## Composables (Hooks) ## Composables (Hooks)
| Composable | Description | | Composable | Description |
| -------------------------- | ------------------------------------------------------------------------------------- | | -------------------------- | -------------------------------------------------------------------------------------- |
| `useInput(handler, opts?)` | Handle keyboard input — receives `(input, key)` with modifier and arrow key detection | | `useInput(handler, opts?)` | Handle keyboard input — receives `(input, key)` with modifier and arrow key detection |
| `usePaste(handler, opts?)` | Handle bracketed paste — receives the pasted `text` as a single event |
| `useFocus(opts?)` | Component-level focus — returns `{ isFocused, focus }` | | `useFocus(opts?)` | Component-level focus — returns `{ isFocused, focus }` |
| `useFocusManager()` | App-level focus control — `focusNext()`, `focusPrevious()`, `focus(id)` | | `useFocusManager()` | App-level focus control — `focusNext()`, `focusPrevious()`, `focus(id)` |
| `useApp()` | App lifecycle — `{ exit(error?), waitUntilRenderFlush() }` | | `useApp()` | App lifecycle — `{ exit(error?), waitUntilRenderFlush() }` |
| `useTerminalSize()` | Reactive terminal dimensions — `{ columns, rows }` | | `useTerminalSize()` | Reactive terminal dimensions — `{ columns, rows }` (Ink-compat alias: `useWindowSize`) |
| `useStdin()` | Access stdin stream and raw mode control | | `useStdin()` | Access stdin stream and raw mode control |
| `useStdout()` | Write directly to stdout | | `useStdout()` | Write directly to stdout |
| `useStderr()` | Write directly to stderr | | `useStderr()` | Write directly to stderr |
| `useBoxMetrics(ref)` | Measure a `<Box>` via a template ref — reactive `{ width, height, left, top }` |
| `useCursor()` | Control the terminal cursor — `setCursorPosition(pos)` in output coordinates |
| `useAnimation(opts?)` | Frame-based animation driver — reactive `{ frame, time, delta }` + `reset()` |
## Testing ## Testing