You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/concepts/layout.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,16 @@ Percent values (`width: '50%'`, `marginLeft: '10%'`) resolve against the parent'
10
10
11
11
## Defaults
12
12
13
+
These are the consumer-facing defaults applied by `<Box>`. The underlying Yoga port keeps its own native defaults internally, but `<Box>` sets the values most Yokai apps actually see.
14
+
13
15
| Property | Yokai default | CSS default |
14
16
|---|---|---|
15
-
|`flexDirection`|`'column'`|`'row'`|
16
-
|`flexShrink`|`0`|`1`|
17
+
|`flexDirection`|`'row'`|`'row'`|
18
+
|`flexShrink`|`1`|`1`|
17
19
|`alignItems`|`'stretch'`|`'stretch'`|
18
20
|`display`|`'flex'`|`'inline'`|
19
21
20
-
`flexDirection: 'column'` matches Yoga's default and aligns with terminal stacking. `flexShrink: 0` is the port's default — children keep their measured size unless the parent overflows. Set `flexShrink={1}` to opt into CSS-style shrink.
22
+
Use `flexDirection="column"` for the common terminal pattern where rows stack vertically. Set `flexShrink={0}` on chrome that must not collapse, such as title bars, footers, and fixed-width sidebars.
Copy file name to clipboardExpand all lines: docs/faq.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Short answers to recurring questions. Each links to the canonical doc page when
8
8
A React reconciler for the terminal. Pure-TS Yoga flexbox, diff-based screen output, ScrollBox with viewport culling. Mount React components, get ANSI on stdout. See [README](./README.md).
9
9
10
10
**How is it different from Ink?**
11
-
Forked from Ink via claude-code-kit. Pure-TypeScript Yoga (no WASM), per-cell frame diffing with DECSTBM scroll hints, native ScrollBox with viewport culling, mouse events with gesture capture, drag/drop/resize primitives, focus groups with arrow navigation, alt-screen, z-index for absolutes. `flexShrink`defaults to `0` (matches Yoga, not CSS or Ink).
11
+
Forked from Ink via claude-code-kit. Pure-TypeScript Yoga (no WASM), per-cell frame diffing with DECSTBM scroll hints, native ScrollBox with viewport culling, mouse events with gesture capture, drag/drop/resize primitives, focus groups with arrow navigation, alt-screen, z-index for absolutes. The public `<Box>` component defaults `flexShrink`to `1` (matching CSS and Ink) while the low-level Yoga port keeps Yoga's native defaults internally.
12
12
13
13
**When NOT to use yokai?**
14
14
For one-shot CLI output (a `--help` screen, a single status line) reach for plain `console.log` or `chalk`. yokai's payoff is interactive trees and sustained renders.
@@ -32,8 +32,8 @@ Standard package install. The build artifacts are emitted by the workspace; no s
32
32
**Why is my Box empty?**
33
33
A Box with no `width`/`height` and no children collapses to zero. Add `flexGrow={1}` to take available space, or set explicit dimensions. See [styles reference](./reference/styles.md).
34
34
35
-
**Why does flexShrink behave differently from CSS?**
36
-
Yokai inherits Yoga's default of `flexShrink: 0`. CSS and Ink default to `1`. To allow a child to shrink past content size, set `flexShrink={1}` explicitly. See [styles reference](./reference/styles.md).
35
+
**Why does my fixed chrome collapse under layout pressure?**
36
+
`<Box>` defaults to `flexShrink={1}`, matching CSS and Ink. That is usually right for content, but fixed chrome such as title bars, footers, and sidebars should opt out with `flexShrink={0}`. See [styles reference](./reference/styles.md).
37
37
38
38
**Why is my absolute element not where I put it?**
39
39
`top`/`left`/`right`/`bottom` are relative to the nearest positioned ancestor (the parent Box, in yokai). Percent strings are percent of parent. `zIndex` is honored only on `position: 'absolute'` and only sorts among siblings of the same parent. See [styles reference](./reference/styles.md).
@@ -71,7 +71,7 @@ The capture cannot be released mid-flight (matches `setPointerCapture`). Track a
71
71
## Resize
72
72
73
73
**Why does my content get clipped?**
74
-
`<Resizable>` clips overflow by default — content larger than the resized box is hidden. Set the inner content to `flexShrink={1}` or use a ScrollBox inside.
74
+
`<Resizable>` clips overflow by default — content larger than the resized box is hidden. Let flexible inner content keep the default `flexShrink={1}`, mark fixed chrome with `flexShrink={0}`, or use a ScrollBox inside.
75
75
76
76
**Can I shrink past content size?**
77
77
Yes — pass `minSize={{ width: 1, height: 1 }}` or whatever floor you want. The default min is content size.
@@ -85,4 +85,4 @@ Use `import { logForDebugging } from '@yokai-tui/shared'`. Direct `console.log`
85
85
Use `renderSync` with a fake `stdout`, then assert on the captured frame. See [testing guide](./guides/testing.md).
86
86
87
87
**How do I handle terminal resize?**
88
-
Read viewport reactively via `useTerminalViewport()`, or bind `onResize` on a Box. SIGWINCH can pulse rapidly during a window-drag-resize — debounce reactive reads. See [troubleshooting](./troubleshooting.md).
88
+
Bind `onResize` on a Box to receive `{ columns, rows }` from SIGWINCH. `useTerminalViewport()` is for visibility tracking of a referenced element, not terminal dimensions. Resize can pulse rapidly during a window-drag-resize, so debounce expensive state updates. See [troubleshooting](./troubleshooting.md).
Copy file name to clipboardExpand all lines: docs/guides/migration-from-ink.md
+2-6Lines changed: 2 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,13 +69,9 @@ Yokai honors `Styles.zIndex` on `position: 'absolute'` nodes. Stacking is per-pa
69
69
70
70
### Pure-TS Yoga
71
71
72
-
Layout runs through `@yokai-tui/shared`'s pure-TypeScript flexbox engine — no WASM, no native binding. One default differs from Ink:
72
+
Layout runs through `@yokai-tui/shared`'s pure-TypeScript flexbox engine — no WASM, no native binding. The low-level Yoga port keeps Yoga's native defaults internally, but the public `<Box>` component applies Ink/CSS-like defaults (`flexDirection="row"`, `flexShrink={1}`).
73
73
74
-
| Property | Ink default | yokai default |
75
-
|----------|-------------|---------------|
76
-
|`flexShrink`| 1 (CSS) | 0 |
77
-
78
-
Existing Ink layouts that relied on automatic shrinking need `flexShrink={1}` set explicitly.
74
+
If fixed chrome such as title bars, footers, or sidebars disappears under layout pressure, set `flexShrink={0}` on that chrome.
**Fires when**: SIGWINCH on the controlling stdout. Bound via `onResize` on `<Box>` (bubble only) or read reactively via `useTerminalViewport`.
210
+
**Fires when**: SIGWINCH on the controlling stdout. Bound via `onResize` on `<Box>` (bubble only). `useTerminalViewport()` is a referenced-element visibility hook and does not expose terminal `{ columns, rows }`.
Copy file name to clipboardExpand all lines: docs/troubleshooting.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,19 +16,19 @@ Tab cycling is global; arrow navigation is opt-in. Wrap the focusable region in
16
16
17
17
### Box overflows its parent
18
18
19
-
Yoga does not shrink children by default. Set `flexShrink={1}` on the child, or`overflow="hidden"` on the parent to clip. For text, also set `wrap="truncate"` or similar.
19
+
`<Box>` children shrink by default (`flexShrink={1}`), matching CSS and Ink. If overflow is intentional chrome, set `flexShrink={0}` on that fixed child; otherwise add`overflow="hidden"` on the parent to clip. For text, also set `wrap="truncate"` or similar.
20
20
21
21
### Text is cut off mid-word
22
22
23
-
Set `wrap="wrap"` on the `<Text>`, or widen the parent container. Wrapping respects terminal width via `useTerminalViewport`. For fixed columns, set `width` on the enclosing Box.
23
+
Set `wrap="wrap"` on the `<Text>`, or widen the parent container. Wrapping follows the terminal width reported through layout/resize; for fixed columns, set `width` on the enclosing Box.
24
24
25
25
### Colors don't show
26
26
27
27
Check the terminal's color capability. Set `FORCE_COLOR=1` to override detection in pipes and CI. `FORCE_COLOR=3` forces 24-bit. If colors render as raw ANSI escapes in output, the terminal is not interpreting them — check `TERM` is set.
28
28
29
29
### Layout flickers on resize
30
30
31
-
Debounce reactive reads from `useTerminalViewport`, or batch state changes in a single `setState` call. Resize fires SIGWINCH, which can pulse rapidly during a drag-resize of the terminal window itself.
31
+
Debounce `onResize` work, or batch state changes in a single `setState` call. Resize fires SIGWINCH, which can pulse rapidly during a drag-resize of the terminal window itself. `useTerminalViewport()` tracks referenced-element visibility, not terminal dimensions.
32
32
33
33
### Drag handle doesn't respond after I add a wrapper around it
0 commit comments