Skip to content

docs: correct viewport hook and box defaults#78

Merged
re-marked merged 2 commits into
mainfrom
codex/docs-correct-viewport-box-defaults
May 7, 2026
Merged

docs: correct viewport hook and box defaults#78
re-marked merged 2 commits into
mainfrom
codex/docs-correct-viewport-box-defaults

Conversation

@re-marked

Copy link
Copy Markdown
Owner

Summary

  • correct README's useTerminalViewport description to the actual [ref, entry] tuple
  • clarify consumer-facing defaults for flexDirection and flexShrink
  • update layout, style reference, debugging, and Ink migration docs to stop presenting Yoga-port defaults as Box defaults

Closes #65.
Closes #66.

Verification

  • Docs-only change; no runtime tests run.

Co-Authored-By: Mark <psyhik17@gmail.com>

Co-Authored-By: Codex <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91bc52b9fc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/reference/styles.md
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | `'row'` | `<Box>` default; pass `'column'` for stacked rows |
| `flexGrow` | `number` | `0` | |
| `flexShrink` | `number` | `0` | **Differs from CSS / Ink (which default to 1).** Pass `1` to enable shrinking |
| `flexShrink` | `number` | `1` | `<Box>` default matches CSS / Ink. Pass `0` for chrome that must not collapse |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Propagate the flexShrink default change

This table now says the public <Box> default is flexShrink={1}, but the repo still tells users the opposite in docs/faq.md lines 11 and 35-36 and docs/troubleshooting.md line 19, including advice to set flexShrink={1} to fix overflow. Because those pages link users back to the styles reference, the documentation now gives contradictory debugging and migration guidance; please update or explicitly scope the remaining Yoga-port statements in the same change.

Useful? React with 👍 / 👎.

Comment thread README.md
| `useStdin()` | Stdin stream + `isRawModeSupported` |
| `useStdout()` | Stdout stream + `write` |
| `useTerminalViewport()` | `{ columns, rows }`, updates on resize |
| `useTerminalViewport()` | `[ref, entry]`, where `entry.isVisible` tracks whether the referenced element is currently in the terminal viewport |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the remaining resize guidance

The README correction makes clear that useTerminalViewport() returns a visibility ref/entry rather than terminal dimensions, but docs/faq.md line 88 and docs/reference/events.md line 210 still direct users handling SIGWINCH/terminal resize to read it reactively. In that resize scenario the hook has no columns/rows return and visibility changes do not trigger rerenders on their own, so the stale guidance will send users to the wrong API; please update those resize docs alongside this hook table.

Useful? React with 👍 / 👎.

Co-Authored-By: Mark <psyhik17@gmail.com>

Co-Authored-By: Codex <noreply@anthropic.com>
@re-marked
re-marked merged commit 03f378c into main May 7, 2026
1 check passed
@re-marked
re-marked deleted the codex/docs-correct-viewport-box-defaults branch May 7, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

D13: CLAUDE.md says flexShrink: 0 is yoga port default — <Box> overrides to 1 D12: README claims useTerminalViewport() returns { columns, rows }

1 participant