### Minimal fullscreen-ink App Example Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/README.md This is a basic example demonstrating how to set up a fullscreen Ink application using the `withFullScreen` wrapper. It displays a simple text message and handles application start and exit. ```typescript import { withFullScreen } from "fullscreen-ink"; import { Box, Text } from "ink"; function App() { return ( Hello, fullscreen world! ); } const app = withFullScreen(); await app.start(); await app.waitUntilExit(); ``` -------------------------------- ### Install fullscreen-ink Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/README.md Install the fullscreen-ink package using npm. ```bash npm i fullscreen-ink ``` -------------------------------- ### Package JSON Build Script Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/configuration.md Sets up the 'prepare' script to automatically build the project using tshy when the package is installed. ```json { "scripts": { "prepare": "tshy" } } ``` -------------------------------- ### Component Switching Without Re-creation Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/withFullScreen.md This example demonstrates how to switch between different Ink components dynamically after the application has started, without creating a new instance. It utilizes the `rerender` method on the Ink instance obtained from `withFullScreen`. ```typescript const ink = withFullScreen(); await ink.start(); // Switch to a different component after 2 seconds setTimeout(() => { ink.instance.rerender(); }, 2000); await ink.waitUntilExit(); ``` -------------------------------- ### Nested FullScreenBox Example (Not Recommended) Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/FullScreenBox.md Demonstrates the incorrect way to nest FullScreenBox components. Nesting can lead to unpredictable sizing behavior. ```typescript // Not recommended Nested content ``` -------------------------------- ### Basic FullScreenBox Usage Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/FullScreenBox.md Demonstrates a simple FullScreenBox that fills the terminal and centers content. Ensure 'fullscreen-ink' and 'ink' are installed. ```typescript import { FullScreenBox } from "fullscreen-ink"; import { Box, Text } from "ink"; function App() { return ( Fullscreen content ); } ``` -------------------------------- ### Waiting Before Instance Access Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/withFullScreen.md Highlights the importance of awaiting the start() promise before accessing the Ink instance. This ensures that the terminal setup is complete and the instance is ready for operations like rerender. ```typescript const ink = withFullScreen(); await ink.start(); // safe to use instance now ink.instance.rerender(); await ink.waitUntilExit(); ``` -------------------------------- ### Install fullscreen-ink Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/index.md Install the fullscreen-ink package using npm. This package requires ink (>=4.4.1) and react (>=18.2.0). ```bash npm install fullscreen-ink ``` -------------------------------- ### Typing a Component with useScreenSize Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/types.md Example demonstrating how to use the useScreenSize hook to create a component that adapts to terminal dimensions. Imports necessary components from fullscreen-ink and ink. ```typescript import { useScreenSize } from "fullscreen-ink"; import { FC } from "react"; import { Box, Text } from "ink"; type SizeAwareProps = { title: string; }; const SizeAwareComponent: FC = ({ title }) => { const { width, height } = useScreenSize(); return ( {title} - {width}x{height} ); }; ``` -------------------------------- ### withFullScreen() Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/index.md High-level wrapper that handles fullscreen setup, alternate screen buffer management, and app lifecycle. It initializes and controls a fullscreen Ink app with automatic alternate screen buffer management. ```APIDOC ## withFullScreen() ### Description Initializes and controls a fullscreen Ink app with automatic alternate screen buffer management. ### Type Function ### Purpose High-level wrapper that handles fullscreen setup, alternate screen buffer management, and app lifecycle. ### Usage Example ```typescript import { withFullScreen } from "fullscreen-ink"; import { Box, Text } from "ink"; function App() { return Press Ctrl+C to exit; } const app = withFullScreen(); await app.start(); await app.waitUntilExit(); ``` ``` -------------------------------- ### Application Usage Imports Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/modules.md Import patterns for using the fullscreen-ink library in an application. Includes options for all-in-one setup or component-based fullscreen. ```typescript // All-in-one fullscreen setup import { withFullScreen } from "fullscreen-ink"; // Component-based fullscreen import { FullScreenBox, useScreenSize } from "fullscreen-ink"; ``` -------------------------------- ### Typing withFullScreen Return Value Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/types.md Demonstrates how to correctly type the instance, start, and waitUntilExit properties returned by the withFullScreen function. This ensures type safety when interacting with the fullscreen application instance. ```typescript import { withFullScreen } from "fullscreen-ink"; import { Instance } from "ink"; const app = withFullScreen(); // Type of app.instance is Instance const instance: Instance = app.instance; // Type of app.start is () => Promise const start: () => Promise = app.start; // Type of app.waitUntilExit is () => Promise const wait: () => Promise = app.waitUntilExit; ``` -------------------------------- ### Accessing Ink Instance for Rerendering Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/withFullScreen.md Illustrates how to access the Ink instance returned by withFullScreen to programmatically rerender the application with different components. Ensure start() has resolved before accessing the instance. ```typescript const ink = withFullScreen(); await ink.start(); // Later, programmatically rerender ink.instance.rerender(); await ink.waitUntilExit(); ``` -------------------------------- ### Basic Fullscreen App with Ctrl+C Exit Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/index.md This pattern shows a minimal fullscreen Ink application that prompts the user to press Ctrl+C to exit. It utilizes `withFullScreen` for setup and `waitUntilExit` for handling the exit condition. ```typescript import { withFullScreen } from "fullscreen-ink"; import { Box, Text } from "ink"; function App() { return Press Ctrl+C to exit; } const app = withFullScreen(); await app.start(); await app.waitUntilExit(); ``` -------------------------------- ### withFullScreen Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/modules.md Wraps a React component to run in fullscreen mode, handling alternate screen buffer management and app lifecycle. It provides methods to start fullscreen mode and wait for the application to exit. ```APIDOC ## withFullScreen(node, options) ### Description Wraps a React component to run in fullscreen mode. ### Method Not applicable (Function signature) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **node**: `ReactNode` - Component to render - **options?**: `RenderOptions` - Optional Ink render options ### Returns - **instance**: `Instance` - Ink render instance - **start()**: `Promise` - Async function to start fullscreen mode - **waitUntilExit()**: `Promise` - Async function to wait for exit ``` -------------------------------- ### Obtaining Screen Size Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/README.md Use the `useScreenSize` hook to get the current terminal height and width. This hook is used internally by `fullscreen-ink`. ```js import { useScreenSize } from "fullscreen-ink"; function MyComponent() { const { height, width } = useScreenSize(); // use height and width as needed } ``` -------------------------------- ### FullScreenBox with Ref Forwarding Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/FullScreenBox.md Demonstrates using `useRef` to get a reference to the underlying Ink Box DOM element. This allows for advanced control or direct manipulation. ```typescript import { useRef } from "react"; import { FullScreenBox } from "fullscreen-ink"; import { Text } from "ink"; import type { DOMElement } from "ink"; function AppWithRef() { const boxRef = useRef(null); return ( Can access box element via ref ); } ``` -------------------------------- ### Exiting the App Gracefully Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/README.md Use Ink's `useApp` hook to get the `exit` method for closing the app cleanly, preventing terminal state issues. ```js import { useApp } from "ink"; // somewhere in a component const app = useApp(); app.exit(); ``` -------------------------------- ### Exported withFullScreen Function Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/modules.md Wraps a React component to run in fullscreen mode, managing alternate screen buffer entry and exit. Call start() to enter fullscreen. ```typescript export const withFullScreen: WithFullScreen = (node, options) => { const instance = render(null, options); const exitPromise = cleanUpOnExit(instance); function waitUntilExit() { return exitPromise; } return { instance: instance, start: async () => { await write("\x1b[?1049h"); // enter alternate buffer instance.rerender({node}); }, waitUntilExit, }; }; ``` -------------------------------- ### useScreenSize() Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/index.md React hook for accessing current terminal dimensions and responding to resize events. It allows you to get the current terminal dimensions and react to resize events. ```APIDOC ## useScreenSize() ### Description Get current terminal dimensions and respond to resize events. ### Type React Hook ### Purpose Accesses current terminal dimensions and subscribes to resize events. ### Usage Example ```typescript import { useScreenSize } from "fullscreen-ink"; import { Box, Text } from "ink"; function ResponsiveApp() { const { width, height } = useScreenSize(); return ( Size: {width}×{height} ); } ``` ``` -------------------------------- ### Custom Layout with FullScreenBox Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/index.md This pattern illustrates how to create a custom layout within a fullscreen Ink application using the `FullScreenBox` component. `FullScreenBox` ensures the content fills the terminal window, and the example shows a simple header, content, and footer structure. ```typescript import { FullScreenBox } from "fullscreen-ink"; import { Box, Text } from "ink"; function CustomLayout() { return ( Header Content Footer ); } ``` -------------------------------- ### TypeScript Type-Only Import Example Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/configuration.md This TypeScript snippet demonstrates how to use type-only imports for Ink types, which are erased during compilation and do not affect the bundle size. ```typescript import type { Instance, RenderOptions } from "ink"; ``` -------------------------------- ### Programmatic Rerender of Fullscreen App Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/index.md Shows how to programmatically update the content of a running fullscreen Ink application. After starting the app with an initial component, its instance can be used to rerender with a different component. ```typescript const app = withFullScreen(); await app.start(); // Later, change the component app.instance.rerender(); await app.waitUntilExit(); ``` -------------------------------- ### Controlled Exit with useApp Hook Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/index.md This pattern demonstrates how to control the exit of an Ink application programmatically using the `useApp` hook. The example sets up a timeout to automatically call the `exit` function after 5 seconds. ```typescript import { useApp } from "ink"; function ControlledApp() { const { exit } = useApp(); useEffect(() => { const timer = setTimeout(() => exit(), 5000); return () => clearTimeout(timer); }, [exit]); return Auto-exit in 5 seconds; } const app = withFullScreen(); await app.start(); await app.waitUntilExit(); ``` -------------------------------- ### useScreenSize Hook Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/modules.md A React hook that returns current terminal dimensions and responds to resize events. It uses Ink's useStdout hook to get dimensions and sets up a resize listener. ```typescript import { useStdout } from "ink"; import { useCallback, useEffect, useState } from "react"; export function useScreenSize() { const { stdout } = useStdout(); const getSize = useCallback( () => ({ height: stdout.rows, width: stdout.columns }), [stdout], ); const [size, setSize] = useState(getSize); useEffect(() => { function onResize() { setSize(getSize()); } stdout.on("resize", onResize); return () => { stdout.off("resize", onResize); }; }, [stdout, getSize]); return size; } ``` -------------------------------- ### FullScreenBox Component Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/modules.md A React forwardRef component that creates a fullscreen box. It prevents input rendering, gets terminal size, and renders an Ink Box with automatic dimensions, forwarding the ref and spreading props. ```typescript export const FullScreenBox = forwardRef( function FullScreenBox(props, ref) { useInput(() => {}); // prevent input from rendering const { height, width } = useScreenSize(); return ; }, ); ``` -------------------------------- ### fullscreen-ink Documentation File Organization Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/README.md This snippet shows the organization of the documentation files for fullscreen-ink, including the main README, overview, API references, and configuration details. ```bash /workspace/home/output/ ├── README.md ← You are here ├── index.md ← Start here for overview ├── types.md ← Type reference ├── configuration.md ← Build & setup configuration ├── modules.md ← Module structure & hierarchy └── api-reference/ ← Detailed API documentation ├── withFullScreen.md ├── useScreenSize.md └── FullScreenBox.md ``` -------------------------------- ### Recommended Layout with Single FullScreenBox Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/FullScreenBox.md Shows the recommended approach for nested layouts using a single root FullScreenBox and regular Ink Boxes inside. ```typescript // Recommended Nested content ``` -------------------------------- ### Responsive Layout Using useScreenSize Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/index.md Demonstrates how to create a responsive Ink application layout using the `useScreenSize` hook. The component dynamically adjusts its size based on the terminal dimensions and displays the current width and height. ```typescript import { useScreenSize } from "fullscreen-ink"; import { Box, Text } from "ink"; function ResponsiveApp() { const { width, height } = useScreenSize(); return ( Size: {width}×{height} ); } ``` -------------------------------- ### Header/Main/Footer Layout with FullScreenBox Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/FullScreenBox.md Demonstrates a common layout pattern with a header, main content, and footer using `flexDirection="column"`. `flexGrow={1}` is used for the main content area. ```typescript import { FullScreenBox } from "fullscreen-ink"; import { Box, Text } from "ink"; function LayoutApp() { return ( Header Main content Footer ); } ``` -------------------------------- ### Adaptive Layout Based on Terminal Dimensions Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/useScreenSize.md Shows how to create a dynamic layout that changes between column and row flexDirection based on terminal width and height. Ensure 'fullscreen-ink' and 'ink' are imported. ```typescript import { useScreenSize } from "fullscreen-ink"; import { Box, Text } from "ink"; function AdaptiveLayout() { const { height, width } = useScreenSize(); const isSmall = width < 80 || height < 24; return ( Left pane {!isSmall && ( Right pane (hidden on small screens) )} ); } ``` -------------------------------- ### Basic Full-Screen App Usage Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/README.md Wrap your Ink app component with `withFullScreen` and call `.start()` to make it full-screen. The terminal content is restored upon exit. ```jsx import { withFullScreen } from "fullscreen-ink"; withFullScreen().start(); ``` -------------------------------- ### Accessing Ink Instance for Rerendering Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/README.md Access the Ink instance via the `instance` property to call methods like `rerender`. It's recommended to `await ink.start()` first to avoid race conditions. ```jsx const ink = withFullScreen(); // ... ink.instance.rerender(); ``` ```jsx const ink = withFullScreen(); await ink.start(); ink.instance.rerender(); ``` -------------------------------- ### Custom Sizing with Manual Width/Height Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/FullScreenBox.md Illustrates how to use FullScreenBox with explicit width and height props to create a box that occupies a percentage of the terminal screen, centered using margins. ```typescript import { FullScreenBox, useScreenSize } from "fullscreen-ink"; import { Box, Text } from "ink"; function PartialScreenBox() { const { width, height } = useScreenSize(); return ( 80% of screen, centered ); } ``` -------------------------------- ### Fullscreen App with Render Options Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/withFullScreen.md Shows how to pass Ink's render options, such as exitOnCtrlC and debug, to withFullScreen. These options are passed directly to Ink's render function. ```typescript const ink = withFullScreen(, { exitOnCtrlC: false, debug: true }); await ink.start(); await ink.waitUntilExit(); ``` -------------------------------- ### Optimizing Component Renders with useMemo Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/useScreenSize.md Demonstrates how to use `useMemo` with the size object returned by `useScreenSize` to prevent unnecessary re-renders in child components. This is a performance optimization technique. ```typescript import { useScreenSize } from "fullscreen-ink"; import { useMemo } from "react"; import { Box, Text } from "ink"; // Assuming ChildComponent exists and accepts a 'size' prop function ChildComponent({ size }) { return Child component size: {size.width}x{size.height}; } function OptimizedComponent() { const size = useScreenSize(); const memoizedSize = useMemo(() => size, [size.width, size.height]); return ; } ``` -------------------------------- ### fullscreen-ink Source Code Structure Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/README.md This snippet outlines the directory structure of the fullscreen-ink source code, indicating the location of the entry point, main wrapper function, fullscreen box component, screen size hook, and demo application. ```bash src/ ├── index.ts Entry point (re-exports) ├── withFullScreen.tsx Main wrapper function ├── FullScreenBox.tsx Fullscreen box component ├── useScreenSize.ts Screen size hook └── demo.tsx Demo application ``` -------------------------------- ### Package JSON Exports Configuration Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/configuration.md Defines the entry point for fullscreen-ink as an ESM-only module, including TypeScript type definitions. ```json { "exports": { ".": { "import": { "types": "./dist/esm/index.d.ts", "default": "./dist/esm/index.js" } } } } ``` -------------------------------- ### FullScreenBox with Border Styling Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/FullScreenBox.md Illustrates applying border styles and padding to the FullScreenBox. This is useful for visually separating the fullscreen content. ```typescript import { FullScreenBox } from "fullscreen-ink"; import { Box, Text } from "ink"; function BorderedApp() { return ( Bordered fullscreen app ); } ``` -------------------------------- ### withFullScreen Function Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/withFullScreen.md Wraps an Ink component to run in fullscreen mode. It returns a control object to manage the fullscreen session. ```APIDOC ## withFullScreen ### Description Wraps an Ink component and makes it run in fullscreen mode using the alternate screen buffer. ### Function Signature ```typescript function withFullScreen( node: ReactNode, options?: RenderOptions ): { instance: Instance; start: () => Promise; waitUntilExit: () => Promise; } ``` ### Parameters #### Parameters - **node** (`ReactNode`) - Required - The React component or element to render in fullscreen - **options** (`RenderOptions`) - Optional - Optional Ink render options (passed directly to Ink's `render` function) `RenderOptions` is an object that accepts any options supported by Ink's `render` function, such as `exitOnCtrlC`, `patchConsole`, and `debug`. ### Return Type Returns an object with the following properties: #### Properties - **instance** (`Instance`) - The Ink instance, identical to what Ink's `render` function returns. Provides direct access to re-render, unmount, and other Ink operations. - **start** (`() => Promise`) - Async method that switches the terminal to the alternate screen buffer and renders the component. Must be called to start the fullscreen app. - **waitUntilExit** (`() => Promise`) - Async method that resolves when the app exits and the alternate screen buffer is cleaned up. Returns the same promise regardless of how many times it is called. ### Usage Examples #### Basic fullscreen app ```typescript import { withFullScreen } from "fullscreen-ink"; import { Box, Text } from "ink"; function App() { return ( Hello, fullscreen world! ); } const ink = withFullScreen(); await ink.start(); await ink.waitUntilExit(); console.log("App closed"); ``` #### With Ink render options ```typescript const ink = withFullScreen(, { exitOnCtrlC: false, debug: true }); await ink.start(); await ink.waitUntilExit(); ``` #### Accessing the Ink instance ```typescript const ink = withFullScreen(); await ink.start(); // Later, programmatically rerender ink.instance.rerender(); await ink.waitUntilExit(); ``` #### Waiting before accessing the instance Due to the asynchronous nature of terminal setup, wait for `start()` to resolve before accessing the instance: ```typescript const ink = withFullScreen(); await ink.start(); // safe to use instance now ink.instance.rerender(); await ink.waitUntilExit(); ``` ``` -------------------------------- ### Type Usage Imports Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/modules.md Import patterns for using type definitions from the Ink library within the fullscreen-ink context. ```typescript // Type definitions from Ink import type { Instance, DOMElement, RenderOptions } from "ink"; ``` -------------------------------- ### Custom Ink Render Options Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/README.md Pass Ink's `render` options, such as `exitOnCtrlC: false`, to `withFullScreen` to customize app behavior. ```jsx withFullScreen(, { exitOnCtrlC: false }).start(); ``` -------------------------------- ### Basic Terminal Size Display Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/useScreenSize.md Demonstrates how to use the useScreenSize hook to display the current terminal width and height within a component. Imports are required from 'fullscreen-ink' and 'ink'. ```typescript import { useScreenSize } from "fullscreen-ink"; import { Box, Text } from "ink"; function ResponsiveComponent() { const { height, width } = useScreenSize(); return ( Terminal size: {width}x{height} ); } ``` -------------------------------- ### Multi-Column Layout Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/useScreenSize.md Creates a two-column layout where each column's width is calculated based on the available terminal width. Use this for side-by-side content presentation. ```typescript function MultiColumn() { const { width } = useScreenSize(); const columnWidth = Math.floor((width - 2) / 2); return ( Column 1 Column 2 ); } ``` -------------------------------- ### Imports for withFullScreen Module Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/modules.md Imports necessary types and functions from 'ink' and local modules for the withFullScreen wrapper. ```typescript import { type Instance, render } from "ink"; import { FullScreenBox } from "./FullScreenBox.js"; ``` -------------------------------- ### Integrating External Event Listeners Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/withFullScreen.md Combine `withFullScreen` with external event listeners, such as `process.on('SIGTERM')`, to handle application exit gracefully. This snippet shows how to use the `useApp` hook to access the `exit` function. ```typescript import { withFullScreen } from "fullscreen-ink"; import { useEffect } from "react"; import { Box, Text, useApp } from "ink"; function EventListeningApp() { const { exit } = useApp(); useEffect(() => { process.on("SIGTERM", () => { console.log("Received SIGTERM, exiting..."); exit(); }); }, [exit]); return Press Ctrl+C or send SIGTERM to exit; } const ink = withFullScreen(); await ink.start(); await ink.waitUntilExit(); ``` -------------------------------- ### Imports for FullScreenBox Module Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/modules.md Imports necessary components and hooks from 'ink', 'react', and local modules for the FullScreenBox component. ```typescript import { Box, type DOMElement, useInput } from "ink"; import { type ComponentPropsWithoutRef, forwardRef } from "react"; import { useScreenSize } from "./useScreenSize.js"; ``` -------------------------------- ### Using useScreenSize in Multiple Components Source: https://github.com/daniguardiola/fullscreen-ink/blob/main/_autodocs/api-reference/useScreenSize.md Illustrates how to use the useScreenSize hook independently in different components (Header, Footer, App) to access terminal dimensions. Requires 'fullscreen-ink' and 'ink'. ```typescript import { useScreenSize } from "fullscreen-ink"; import { Box, Text } from "ink"; function Header() { const { width } = useScreenSize(); return ( Application Header ({width} cols) ); } function Footer() { const { width } = useScreenSize(); return ( Application Footer ({width} cols) ); } function App() { const { height } = useScreenSize(); return (
Main content area