[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-1357":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":23,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":32,"readmeContent":33,"aiSummary":34,"trendingCount":16,"starSnapshotCount":16,"syncStatus":35,"lastSyncTime":36,"discoverSource":37},1357,"ink","vadimdemedes\u002Fink","vadimdemedes","🌈 React for interactive command-line apps","https:\u002F\u002Fterm.ink",null,"TypeScript",38866,1010,122,15,0,18,101,570,86,44.01,"MIT License",false,"master",[26,27,28,29,30,31],"cli","command-line","flexbox","interactive","javascript","react","2026-06-12 02:00:26","[![](https:\u002F\u002Fraw.githubusercontent.com\u002Fvshymanskyy\u002FStandWithUkraine\u002Fmain\u002Fbanner2-direct.svg)](https:\u002F\u002Fgithub.com\u002Fvshymanskyy\u002FStandWithUkraine\u002Fblob\u002Fmain\u002Fdocs\u002FREADME.md)\n\n---\n\n\u003Cdiv align=\"center\">\n\t\u003Cbr>\n\t\u003Cbr>\n\t\u003Cimg width=\"240\" alt=\"Ink\" src=\"media\u002Flogo.png\">\n\t\u003Cbr>\n\t\u003Cbr>\n\t\u003Cbr>\n\u003C\u002Fdiv>\n\n> React for CLIs. Build and test your CLI output using components.\n\n[![Build Status](https:\u002F\u002Fgithub.com\u002Fvadimdemedes\u002Fink\u002Fworkflows\u002Ftest\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fvadimdemedes\u002Fink\u002Factions)\n[![npm](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fdm\u002Fink?logo=npm)](https:\u002F\u002Fnpmjs.com\u002Fpackage\u002Fink)\n\nInk provides the same component-based UI building experience that React offers in the browser, but for command-line apps.\nIt uses [Yoga](https:\u002F\u002Fgithub.com\u002Ffacebook\u002Fyoga) to build Flexbox layouts in the terminal, so most CSS-like properties are available in Ink as well.\nIf you are already familiar with React, you already know Ink.\n\nSince Ink is a React renderer, all features of React are supported.\nHead over to the [React](https:\u002F\u002Freactjs.org) website for documentation on how to use it.\nOnly Ink's methods are documented in this readme.\n\n**Fully AI-generated pull requests are not accepted. You can use AI, but should be verified and cleaned up by a human. Only Opus 4.6+ (high-effort) and Codex 5.4+ (extra high) are accepted models. Preferably created with Opus and verified by Codex.**\n\n---\n\n\u003Cdiv align=\"center\">\n\t\u003Cp>\n\t\t\u003Cp>\n\t\t\t\u003Csup>\n\t\t\t\t\u003Ca href=\"https:\u002F\u002Fopencollective.com\u002Fvadimdemedes\">My open source work is supported by the community ❤️\u003C\u002Fa>\n\t\t\t\u003C\u002Fsup>\n\t\t\u003C\u002Fp>\n\t\u003C\u002Fp>\n\u003C\u002Fdiv>\n\n## Install\n\n```sh\nnpm install ink react\n```\n\n> [!NOTE]\n> This readme documents the upcoming version of Ink. For the latest stable release, see [Ink on npm](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fink).\n\n## Usage\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Text} from 'ink';\n\nconst Counter = () => {\n\tconst [counter, setCounter] = useState(0);\n\n\tuseEffect(() => {\n\t\tconst timer = setInterval(() => {\n\t\t\tsetCounter(previousCounter => previousCounter + 1);\n\t\t}, 100);\n\n\t\treturn () => {\n\t\t\tclearInterval(timer);\n\t\t};\n\t}, []);\n\n\treturn \u003CText color=\"green\">{counter} tests passed\u003C\u002FText>;\n};\n\nrender(\u003CCounter \u002F>);\n```\n\n\u003Cimg src=\"media\u002Fdemo.svg\" width=\"600\">\n\n## Who's Using Ink?\n\n- [Claude Code](https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fclaude-code) - An agentic coding tool made by Anthropic.\n- [Gemini CLI](https:\u002F\u002Fgithub.com\u002Fgoogle-gemini\u002Fgemini-cli) - An agentic coding tool made by Google.\n- [GitHub Copilot CLI](https:\u002F\u002Fgithub.com\u002Ffeatures\u002Fcopilot\u002Fcli) - Just say what you want the shell to do.\n- [Canva CLI](https:\u002F\u002Fwww.canva.dev\u002Fdocs\u002Fapps\u002Fcanva-cli\u002F) - CLI for creating and managing Canva Apps.\n- [Cloudflare's Wrangler](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fwrangler2) - The CLI for Cloudflare Workers.\n- [Linear](https:\u002F\u002Flinear.app) - Linear built an internal CLI for managing deployments, configs, and other housekeeping tasks.\n- [Gatsby](https:\u002F\u002Fwww.gatsbyjs.org) - Gatsby is a modern web framework for blazing-fast websites.\n- [tap](https:\u002F\u002Fnode-tap.org) - A Test-Anything-Protocol library for JavaScript.\n- [Terraform CDK](https:\u002F\u002Fgithub.com\u002Fhashicorp\u002Fterraform-cdk) - Cloud Development Kit (CDK) for HashiCorp Terraform.\n- [Specify CLI](https:\u002F\u002Fspecifyapp.com) - Automate the distribution of your design tokens.\n- [Twilio's SIGNAL](https:\u002F\u002Fgithub.com\u002Ftwilio-labs\u002Fplugin-signal2020) - CLI for Twilio's SIGNAL conference. [Blog post](https:\u002F\u002Fwww.twilio.com\u002Fblog\u002Fbuilding-conference-cli-in-react).\n- [Typewriter](https:\u002F\u002Fgithub.com\u002Fsegmentio\u002Ftypewriter) - Generates strongly-typed [Segment](https:\u002F\u002Fsegment.com) analytics clients from arbitrary JSON Schema.\n- [Prisma](https:\u002F\u002Fwww.prisma.io) - The unified data layer for modern applications.\n- [Blitz](https:\u002F\u002Fblitzjs.com) - The Fullstack React Framework.\n- [New York Times](https:\u002F\u002Fgithub.com\u002Fnytimes\u002Fkyt) - NYT uses Ink's `kyt` - a toolkit that encapsulates and manages the configuration for web apps.\n- [tink](https:\u002F\u002Fgithub.com\u002Fnpm\u002Ftink) - A next-generation runtime and package manager.\n- [Inkle](https:\u002F\u002Fgithub.com\u002Fjrr\u002Finkle) - A Wordle game.\n- [loki](https:\u002F\u002Fgithub.com\u002Foblador\u002Floki) - Visual regression testing tool for Storybook.\n- [Bit](https:\u002F\u002Fgithub.com\u002Fteambit\u002Fbit) - Build, distribute, and collaborate on components.\n- [Remirror](https:\u002F\u002Fgithub.com\u002Fremirror\u002Fremirror) - Your friendly, world-class editor toolkit.\n- [Prime](https:\u002F\u002Fgithub.com\u002Fbirkir\u002Fprime) - Open-source GraphQL CMS.\n- [emoj](https:\u002F\u002Fgithub.com\u002Fsindresorhus\u002Femoj) - Find relevant emojis.\n- [emma](https:\u002F\u002Fgithub.com\u002Fmaticzav\u002Femma-cli) - Find and install npm packages easily.\n- [npm-check-extras](https:\u002F\u002Fgithub.com\u002Fakgondber\u002Fnpm-check-extras) - Check for outdated and unused dependencies, and run update\u002Fdelete actions on selected ones.\n- [swiff](https:\u002F\u002Fgithub.com\u002Fsimple-integrated-marketing\u002Fswiff) - Multi-environment command-line tools for time-saving web developers.\n- [share](https:\u002F\u002Fgithub.com\u002Fmarionebl\u002Fshare-cli) - Share files quickly.\n- [Kubelive](https:\u002F\u002Fgithub.com\u002Fameerthehacker\u002Fkubelive) - A CLI for Kubernetes that provides live data about the cluster and its resources.\n- [changelog-view](https:\u002F\u002Fgithub.com\u002Fjdeniau\u002Fchangelog-view) - View changelogs.\n- [cfpush](https:\u002F\u002Fgithub.com\u002Fmamachanko\u002Fcfpush) - Interactive Cloud Foundry tutorial.\n- [startd](https:\u002F\u002Fgithub.com\u002Fmgrip\u002Fstartd) - Turn your React component into a web app.\n- [wiki-cli](https:\u002F\u002Fgithub.com\u002Fhexrcs\u002Fwiki-cli) - Search Wikipedia and read article summaries.\n- [garson](https:\u002F\u002Fgithub.com\u002Fgoliney\u002Fgarson) - Build interactive, config-based command-line interfaces.\n- [git-contrib-calendar](https:\u002F\u002Fgithub.com\u002Fgiannisp\u002Fgit-contrib-calendar) - Display a contributions calendar for any Git repository.\n- [gitgud](https:\u002F\u002Fgithub.com\u002FGitGud-org\u002FGitGud) - Interactive command-line GUI for Git.\n- [Autarky](https:\u002F\u002Fgithub.com\u002Fpranshuchittora\u002Fautarky) - Find and delete old `node_modules` directories to free up disk space.\n- [fast-cli](https:\u002F\u002Fgithub.com\u002Fsindresorhus\u002Ffast-cli) - Test your download and upload speeds.\n- [tasuku](https:\u002F\u002Fgithub.com\u002Fprivatenumber\u002Ftasuku) - Minimal task runner.\n- [mnswpr](https:\u002F\u002Fgithub.com\u002Fmordv\u002Fmnswpr) - A Minesweeper game.\n- [lrn](https:\u002F\u002Fgithub.com\u002Fkrychu\u002Flrn) - Learning by repetition.\n- [turdle](https:\u002F\u002Fgithub.com\u002Fmynameisankit\u002Fturdle) - A Wordle game.\n- [Shopify CLI](https:\u002F\u002Fgithub.com\u002FShopify\u002Fcli) - Build apps, themes, and storefronts for the Shopify platform.\n- [ToDesktop CLI](https:\u002F\u002Fwww.todesktop.com\u002Felectron) - All-in-one platform for building Electron apps.\n- [Walle](https:\u002F\u002Fgithub.com\u002FPobepto\u002Fwalle) - A full-featured crypto wallet for EVM networks.\n- [Sudoku](https:\u002F\u002Fgithub.com\u002Fmrozio13pl\u002Fsudoku-in-terminal) - A Sudoku game.\n- [Sea Trader](https:\u002F\u002Fgithub.com\u002Fzyishai\u002Fsea-trader) - A Taipan!-inspired trading simulator game.\n- [srtd](https:\u002F\u002Fgithub.com\u002Ft1mmen\u002Fsrtd) - Live-reloading SQL templates for Supabase projects.\n- [tweakcc](https:\u002F\u002Fgithub.com\u002FPiebald-AI\u002Ftweakcc) - Customize your Claude Code styling.\n- [argonaut](https:\u002F\u002Fgithub.com\u002Fdarksworm\u002Fargonaut) - Manage Argo CD resources.\n- [Qodo Command](https:\u002F\u002Fgithub.com\u002Fqodo-ai\u002Fcommand) - Build, run, and manage AI agents.\n- [Nanocoder](https:\u002F\u002Fgithub.com\u002Fnano-collective\u002Fnanocoder) - A community-built, local-first AI coding agent with multi-provider support.\n- [dev3000](https:\u002F\u002Fgithub.com\u002Fvercel-labs\u002Fdev3000) - An AI agent MCP orchestrator and developer browser.\n- [Neovate Code](https:\u002F\u002Fgithub.com\u002Fneovateai\u002Fneovate-code) - An agentic coding tool made by AntGroup.\n- [instagram-cli](https:\u002F\u002Fgithub.com\u002Fsupreme-gg-gg\u002Finstagram-cli) - Instagram client.\n- [ElevenLabs CLI](https:\u002F\u002Fgithub.com\u002Felevenlabs\u002Fcli) - ElevenLabs agents client.\n- [SSH AI Chat](https:\u002F\u002Fgithub.com\u002Fmiantiao-me\u002Fssh-ai-chat) - Chat with AI over SSH.\n\n_(PRs welcome. Append new entries at the end. Repos must have 100+ stars and showcase Ink beyond a basic list picker.)_\n\n## Contents\n\n- [Getting Started](#getting-started)\n- [App Lifecycle](#app-lifecycle)\n- [Components](#components)\n  - [`\u003CText>`](#text)\n  - [`\u003CBox>`](#box)\n  - [`\u003CNewline>`](#newline)\n  - [`\u003CSpacer>`](#spacer)\n  - [`\u003CStatic>`](#static)\n  - [`\u003CTransform>`](#transform)\n- [Hooks](#hooks)\n  - [`useInput`](#useinputinputhandler-options)\n  - [`usePaste`](#usepastehandler-options)\n  - [`useApp`](#useapp)\n  - [`useStdin`](#usestdin)\n  - [`useStdout`](#usestdout)\n  - [`useBoxMetrics`](#useboxmetricsref)\n  - [`useStderr`](#usestderr)\n  - [`useWindowSize`](#usewindowsize)\n  - [`useFocus`](#usefocusoptions)\n  - [`useFocusManager`](#usefocusmanager)\n  - [`useCursor`](#usecursor)\n  - [`useAnimation`](#useanimationoptions)\n- [API](#api)\n- [Testing](#testing)\n- [Using React Devtools](#using-react-devtools)\n- [Screen Reader Support](#screen-reader-support)\n- [Useful Components](#useful-components)\n- [Useful Hooks](#useful-hooks)\n- [Recipes](#recipes)\n- [Examples](#examples)\n- [Continuous Integration](#continuous-integration)\n\n## Getting Started\n\nUse [create-ink-app](https:\u002F\u002Fgithub.com\u002Fvadimdemedes\u002Fcreate-ink-app) to quickly scaffold a new Ink-based CLI.\n\n```sh\nnpx create-ink-app my-ink-cli\n```\n\nAlternatively, create a TypeScript project:\n\n```sh\nnpx create-ink-app --typescript my-ink-cli\n```\n\n\u003Cdetails>\u003Csummary>Manual JavaScript setup\u003C\u002Fsummary>\n\u003Cp>\nInk requires the same Babel setup as you would do for regular React-based apps in the browser.\n\nSet up Babel with a React preset to ensure all examples in this readme work as expected.\nAfter [installing Babel](https:\u002F\u002Fbabeljs.io\u002Fdocs\u002Fen\u002Fusage), install `@babel\u002Fpreset-react` and insert the following configuration in `babel.config.json`:\n\n```sh\nnpm install --save-dev @babel\u002Fpreset-react\n```\n\n```json\n{\n\t\"presets\": [\"@babel\u002Fpreset-react\"]\n}\n```\n\nNext, create a file `source.js`, where you'll type code that uses Ink:\n\n```jsx\nimport React from 'react';\nimport {render, Text} from 'ink';\n\nconst Demo = () => \u003CText>Hello World\u003C\u002FText>;\n\nrender(\u003CDemo \u002F>);\n```\n\nThen, transpile this file with Babel:\n\n```sh\nnpx babel source.js -o cli.js\n```\n\nNow you can run `cli.js` with Node.js:\n\n```sh\nnode cli\n```\n\nIf you don't like transpiling files during development, you can use [import-jsx](https:\u002F\u002Fgithub.com\u002Fvadimdemedes\u002Fimport-jsx) or [@esbuild-kit\u002Fesm-loader](https:\u002F\u002Fgithub.com\u002Fesbuild-kit\u002Fesm-loader) to `import` a JSX file and transpile it on the fly.\n\n\u003C\u002Fp>\n\u003C\u002Fdetails>\n\nInk uses [Yoga](https:\u002F\u002Fgithub.com\u002Ffacebook\u002Fyoga), a Flexbox layout engine, to build great user interfaces for your CLIs using familiar CSS-like properties you've used when building apps for the browser.\nIt's important to remember that each element is a Flexbox container.\nThink of it as if every `\u003Cdiv>` in the browser had `display: flex`.\nSee [`\u003CBox>`](#box) built-in component below for documentation on how to use Flexbox layouts in Ink.\nNote that all text must be wrapped in a [`\u003CText>`](#text) component.\n\n## App Lifecycle\n\nAn Ink app is a Node.js process, so it stays alive only while there is active work in the event loop (timers, pending promises, [`useInput`](#useinputinputhandler-options) listening on `stdin`, etc.). If your component tree has no async work, the app will render once and exit immediately.\n\nTo exit the app, press **Ctrl+C** (enabled by default via [`exitOnCtrlC`](#exitonctrlc)), call [`exit()`](#exiterrororresult) from [`useApp`](#useapp) inside a component, or call [`unmount()`](#unmount) on the object returned by [`render()`](#rendertree-options).\n\nUse [`waitUntilExit()`](#waituntilexit) to run code after the app is unmounted:\n\n```jsx\nconst {waitUntilExit} = render(\u003CMyApp \u002F>);\n\nawait waitUntilExit();\n\nconsole.log('App exited');\n```\n\n## Components\n\n### `\u003CText>`\n\nThis component can display text and change its style to make it bold, underlined, italic, or strikethrough.\n\n```jsx\nimport {render, Text} from 'ink';\n\nconst Example = () => (\n\t\u003C>\n\t\t\u003CText color=\"green\">I am green\u003C\u002FText>\n\t\t\u003CText color=\"black\" backgroundColor=\"white\">\n\t\t\tI am black on white\n\t\t\u003C\u002FText>\n\t\t\u003CText color=\"#ffffff\">I am white\u003C\u002FText>\n\t\t\u003CText bold>I am bold\u003C\u002FText>\n\t\t\u003CText italic>I am italic\u003C\u002FText>\n\t\t\u003CText underline>I am underline\u003C\u002FText>\n\t\t\u003CText strikethrough>I am strikethrough\u003C\u002FText>\n\t\t\u003CText inverse>I am inversed\u003C\u002FText>\n\t\u003C\u002F>\n);\n\nrender(\u003CExample \u002F>);\n```\n\n> [!NOTE]\n> `\u003CText>` allows only text nodes and nested `\u003CText>` components inside of it. For example, `\u003CBox>` component can't be used inside `\u003CText>`.\n\n#### color\n\nType: `string`\n\nChange text color.\nInk uses [chalk](https:\u002F\u002Fgithub.com\u002Fchalk\u002Fchalk) under the hood, so all its functionality is supported.\n\n```jsx\n\u003CText color=\"green\">Green\u003C\u002FText>\n\u003CText color=\"#005cc5\">Blue\u003C\u002FText>\n\u003CText color=\"rgb(232, 131, 136)\">Red\u003C\u002FText>\n```\n\n\u003Cimg src=\"media\u002Ftext-color.jpg\" width=\"247\">\n\n#### backgroundColor\n\nType: `string`\n\nSame as `color` above, but for background.\n\n```jsx\n\u003CText backgroundColor=\"green\" color=\"white\">Green\u003C\u002FText>\n\u003CText backgroundColor=\"#005cc5\" color=\"white\">Blue\u003C\u002FText>\n\u003CText backgroundColor=\"rgb(232, 131, 136)\" color=\"white\">Red\u003C\u002FText>\n```\n\n\u003Cimg src=\"media\u002Ftext-backgroundColor.jpg\" width=\"226\">\n\n#### dimColor\n\nType: `boolean`\\\nDefault: `false`\n\nDim the color (make it less bright).\n\n```jsx\n\u003CText color=\"red\" dimColor>\n\tDimmed Red\n\u003C\u002FText>\n```\n\n\u003Cimg src=\"media\u002Ftext-dimColor.jpg\" width=\"138\">\n\n#### bold\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text bold.\n\n#### italic\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text italic.\n\n#### underline\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text underlined.\n\n#### strikethrough\n\nType: `boolean`\\\nDefault: `false`\n\nMake the text crossed with a line.\n\n#### inverse\n\nType: `boolean`\\\nDefault: `false`\n\nInvert background and foreground colors.\n\n```jsx\n\u003CText inverse color=\"yellow\">\n\tInversed Yellow\n\u003C\u002FText>\n```\n\n\u003Cimg src=\"media\u002Ftext-inverse.jpg\" width=\"138\">\n\n#### wrap\n\nType: `string`\\\nAllowed values: `wrap` `hard` `truncate` `truncate-start` `truncate-middle` `truncate-end`\\\nDefault: `wrap`\n\nThis property tells Ink to wrap or truncate text if its width is larger than the container.\nIf `wrap` is passed (the default), Ink will wrap text and split it into multiple lines.\nIf `hard` is passed, Ink will fill each line to the full column width, breaking words as necessary.\nIf `truncate-*` is passed, Ink will truncate text instead, resulting in one line of text with the rest cut off.\n\n```jsx\n\u003CBox width={7}>\n\t\u003CText>Hello World\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F=> 'Hello\\nWorld'\n\n\u003CBox width={7}>\n\t\u003CText wrap=\"hard\">Hello World\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F=> 'Hello W\\norld'\n\n\u002F\u002F `truncate` is an alias to `truncate-end`\n\u003CBox width={7}>\n\t\u003CText wrap=\"truncate\">Hello World\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F=> 'Hello…'\n\n\u003CBox width={7}>\n\t\u003CText wrap=\"truncate-middle\">Hello World\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F=> 'He…ld'\n\n\u003CBox width={7}>\n\t\u003CText wrap=\"truncate-start\">Hello World\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F=> '…World'\n```\n\n### `\u003CBox>`\n\n`\u003CBox>` is an essential Ink component to build your layout.\nIt's like `\u003Cdiv style=\"display: flex\">` in the browser.\n\n```jsx\nimport {render, Box, Text} from 'ink';\n\nconst Example = () => (\n\t\u003CBox margin={2}>\n\t\t\u003CText>This is a box with margin\u003C\u002FText>\n\t\u003C\u002FBox>\n);\n\nrender(\u003CExample \u002F>);\n```\n\n#### Dimensions\n\n##### width\n\nType: `number` `string`\n\nWidth of the element in spaces.\nYou can also set it as a percentage, which will calculate the width based on the width of the parent element.\n\n```jsx\n\u003CBox width={4}>\n\t\u003CText>X\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F=> 'X   '\n```\n\n```jsx\n\u003CBox width={10}>\n\t\u003CBox width=\"50%\">\n\t\t\u003CText>X\u003C\u002FText>\n\t\u003C\u002FBox>\n\t\u003CText>Y\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F=> 'X    Y'\n```\n\n##### height\n\nType: `number` `string`\n\nHeight of the element in lines (rows).\nYou can also set it as a percentage, which will calculate the height based on the height of the parent element.\n\n```jsx\n\u003CBox height={4}>\n\t\u003CText>X\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F=> 'X\\n\\n\\n'\n```\n\n```jsx\n\u003CBox height={6} flexDirection=\"column\">\n\t\u003CBox height=\"50%\">\n\t\t\u003CText>X\u003C\u002FText>\n\t\u003C\u002FBox>\n\t\u003CText>Y\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F=> 'X\\n\\n\\nY\\n\\n'\n```\n\n##### minWidth\n\nType: `number`\n\nSets a minimum width of the element.\nPercentages aren't supported yet; see https:\u002F\u002Fgithub.com\u002Ffacebook\u002Fyoga\u002Fissues\u002F872.\n\n##### minHeight\n\nType: `number` `string`\n\nSets a minimum height of the element in lines (rows).\nYou can also set it as a percentage, which will calculate the minimum height based on the height of the parent element.\n\n##### maxWidth\n\nType: `number`\n\nSets a maximum width of the element.\nPercentages aren't supported yet; see https:\u002F\u002Fgithub.com\u002Ffacebook\u002Fyoga\u002Fissues\u002F872.\n\n##### maxHeight\n\nType: `number` `string`\n\nSets a maximum height of the element in lines (rows).\nYou can also set it as a percentage, which will calculate the maximum height based on the height of the parent element.\n\n##### aspectRatio\n\nType: `number`\n\nDefines the aspect ratio (width\u002Fheight) for the element.\n\nUse it with at least one size constraint (`width`, `height`, `minHeight`, or `maxHeight`) so Ink can derive the missing dimension.\n\n#### Padding\n\n##### paddingTop\n\nType: `number`\\\nDefault: `0`\n\nTop padding.\n\n##### paddingBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom padding.\n\n##### paddingLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft padding.\n\n##### paddingRight\n\nType: `number`\\\nDefault: `0`\n\nRight padding.\n\n##### paddingX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal padding. Equivalent to setting `paddingLeft` and `paddingRight`.\n\n##### paddingY\n\nType: `number`\\\nDefault: `0`\n\nVertical padding. Equivalent to setting `paddingTop` and `paddingBottom`.\n\n##### padding\n\nType: `number`\\\nDefault: `0`\n\nPadding on all sides. Equivalent to setting `paddingTop`, `paddingBottom`, `paddingLeft` and `paddingRight`.\n\n```jsx\n\u003CBox paddingTop={2}>\u003CText>Top\u003C\u002FText>\u003C\u002FBox>\n\u003CBox paddingBottom={2}>\u003CText>Bottom\u003C\u002FText>\u003C\u002FBox>\n\u003CBox paddingLeft={2}>\u003CText>Left\u003C\u002FText>\u003C\u002FBox>\n\u003CBox paddingRight={2}>\u003CText>Right\u003C\u002FText>\u003C\u002FBox>\n\u003CBox paddingX={2}>\u003CText>Left and right\u003C\u002FText>\u003C\u002FBox>\n\u003CBox paddingY={2}>\u003CText>Top and bottom\u003C\u002FText>\u003C\u002FBox>\n\u003CBox padding={2}>\u003CText>Top, bottom, left and right\u003C\u002FText>\u003C\u002FBox>\n```\n\n#### Margin\n\n##### marginTop\n\nType: `number`\\\nDefault: `0`\n\nTop margin.\n\n##### marginBottom\n\nType: `number`\\\nDefault: `0`\n\nBottom margin.\n\n##### marginLeft\n\nType: `number`\\\nDefault: `0`\n\nLeft margin.\n\n##### marginRight\n\nType: `number`\\\nDefault: `0`\n\nRight margin.\n\n##### marginX\n\nType: `number`\\\nDefault: `0`\n\nHorizontal margin. Equivalent to setting `marginLeft` and `marginRight`.\n\n##### marginY\n\nType: `number`\\\nDefault: `0`\n\nVertical margin. Equivalent to setting `marginTop` and `marginBottom`.\n\n##### margin\n\nType: `number`\\\nDefault: `0`\n\nMargin on all sides. Equivalent to setting `marginTop`, `marginBottom`, `marginLeft` and `marginRight`.\n\n```jsx\n\u003CBox marginTop={2}>\u003CText>Top\u003C\u002FText>\u003C\u002FBox>\n\u003CBox marginBottom={2}>\u003CText>Bottom\u003C\u002FText>\u003C\u002FBox>\n\u003CBox marginLeft={2}>\u003CText>Left\u003C\u002FText>\u003C\u002FBox>\n\u003CBox marginRight={2}>\u003CText>Right\u003C\u002FText>\u003C\u002FBox>\n\u003CBox marginX={2}>\u003CText>Left and right\u003C\u002FText>\u003C\u002FBox>\n\u003CBox marginY={2}>\u003CText>Top and bottom\u003C\u002FText>\u003C\u002FBox>\n\u003CBox margin={2}>\u003CText>Top, bottom, left and right\u003C\u002FText>\u003C\u002FBox>\n```\n\n#### Gap\n\n#### gap\n\nType: `number`\\\nDefault: `0`\n\nSize of the gap between an element's columns and rows. A shorthand for `columnGap` and `rowGap`.\n\n```jsx\n\u003CBox gap={1} width={3} flexWrap=\"wrap\">\n\t\u003CText>A\u003C\u002FText>\n\t\u003CText>B\u003C\u002FText>\n\t\u003CText>C\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F A B\n\u002F\u002F\n\u002F\u002F C\n```\n\n#### columnGap\n\nType: `number`\\\nDefault: `0`\n\nSize of the gap between an element's columns.\n\n```jsx\n\u003CBox columnGap={1}>\n\t\u003CText>A\u003C\u002FText>\n\t\u003CText>B\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F A B\n```\n\n#### rowGap\n\nType: `number`\\\nDefault: `0`\n\nSize of the gap between an element's rows.\n\n```jsx\n\u003CBox flexDirection=\"column\" rowGap={1}>\n\t\u003CText>A\u003C\u002FText>\n\t\u003CText>B\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F A\n\u002F\u002F\n\u002F\u002F B\n```\n\n#### Flex\n\n##### flexGrow\n\nType: `number`\\\nDefault: `0`\n\nSee [flex-grow](https:\u002F\u002Fcss-tricks.com\u002Falmanac\u002Fproperties\u002Ff\u002Fflex-grow\u002F).\n\n```jsx\n\u003CBox>\n\t\u003CText>Label:\u003C\u002FText>\n\t\u003CBox flexGrow={1}>\n\t\t\u003CText>Fills all remaining space\u003C\u002FText>\n\t\u003C\u002FBox>\n\u003C\u002FBox>\n```\n\n##### flexShrink\n\nType: `number`\\\nDefault: `1`\n\nSee [flex-shrink](https:\u002F\u002Fcss-tricks.com\u002Falmanac\u002Fproperties\u002Ff\u002Fflex-shrink\u002F).\n\n```jsx\n\u003CBox width={20}>\n\t\u003CBox flexShrink={2} width={10}>\n\t\t\u003CText>Will be 1\u002F4\u003C\u002FText>\n\t\u003C\u002FBox>\n\t\u003CBox width={10}>\n\t\t\u003CText>Will be 3\u002F4\u003C\u002FText>\n\t\u003C\u002FBox>\n\u003C\u002FBox>\n```\n\n##### flexBasis\n\nType: `number` `string`\n\nSee [flex-basis](https:\u002F\u002Fcss-tricks.com\u002Falmanac\u002Fproperties\u002Ff\u002Fflex-basis\u002F).\n\n```jsx\n\u003CBox width={6}>\n\t\u003CBox flexBasis={3}>\n\t\t\u003CText>X\u003C\u002FText>\n\t\u003C\u002FBox>\n\t\u003CText>Y\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F=> 'X  Y'\n```\n\n```jsx\n\u003CBox width={6}>\n\t\u003CBox flexBasis=\"50%\">\n\t\t\u003CText>X\u003C\u002FText>\n\t\u003C\u002FBox>\n\t\u003CText>Y\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F=> 'X  Y'\n```\n\n##### flexDirection\n\nType: `string`\\\nAllowed values: `row` `row-reverse` `column` `column-reverse`\n\nSee [flex-direction](https:\u002F\u002Fcss-tricks.com\u002Falmanac\u002Fproperties\u002Ff\u002Fflex-direction\u002F).\n\n```jsx\n\u003CBox>\n\t\u003CBox marginRight={1}>\n\t\t\u003CText>X\u003C\u002FText>\n\t\u003C\u002FBox>\n\t\u003CText>Y\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F X Y\n\n\u003CBox flexDirection=\"row-reverse\">\n\t\u003CText>X\u003C\u002FText>\n\t\u003CBox marginRight={1}>\n\t\t\u003CText>Y\u003C\u002FText>\n\t\u003C\u002FBox>\n\u003C\u002FBox>\n\u002F\u002F Y X\n\n\u003CBox flexDirection=\"column\">\n\t\u003CText>X\u003C\u002FText>\n\t\u003CText>Y\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F X\n\u002F\u002F Y\n\n\u003CBox flexDirection=\"column-reverse\">\n\t\u003CText>X\u003C\u002FText>\n\t\u003CText>Y\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F Y\n\u002F\u002F X\n```\n\n##### flexWrap\n\nType: `string`\\\nAllowed values: `nowrap` `wrap` `wrap-reverse`\n\nSee [flex-wrap](https:\u002F\u002Fcss-tricks.com\u002Falmanac\u002Fproperties\u002Ff\u002Fflex-wrap\u002F).\n\n```jsx\n\u003CBox width={2} flexWrap=\"wrap\">\n\t\u003CText>A\u003C\u002FText>\n\t\u003CText>BC\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F A\n\u002F\u002F B C\n```\n\n```jsx\n\u003CBox flexDirection=\"column\" height={2} flexWrap=\"wrap\">\n\t\u003CText>A\u003C\u002FText>\n\t\u003CText>B\u003C\u002FText>\n\t\u003CText>C\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F A C\n\u002F\u002F B\n```\n\n##### alignItems\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end` `stretch` `baseline`\n\nSee [align-items](https:\u002F\u002Fcss-tricks.com\u002Falmanac\u002Fproperties\u002Fa\u002Falign-items\u002F).\n\n```jsx\n\u003CBox alignItems=\"flex-start\">\n\t\u003CBox marginRight={1}>\n\t\t\u003CText>X\u003C\u002FText>\n\t\u003C\u002FBox>\n\t\u003CText>\n\t\tA\n\t\t\u003CNewline\u002F>\n\t\tB\n\t\t\u003CNewline\u002F>\n\t\tC\n\t\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F X A\n\u002F\u002F   B\n\u002F\u002F   C\n\n\u003CBox alignItems=\"center\">\n\t\u003CBox marginRight={1}>\n\t\t\u003CText>X\u003C\u002FText>\n\t\u003C\u002FBox>\n\t\u003CText>\n\t\tA\n\t\t\u003CNewline\u002F>\n\t\tB\n\t\t\u003CNewline\u002F>\n\t\tC\n\t\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F   A\n\u002F\u002F X B\n\u002F\u002F   C\n\n\u003CBox alignItems=\"flex-end\">\n\t\u003CBox marginRight={1}>\n\t\t\u003CText>X\u003C\u002FText>\n\t\u003C\u002FBox>\n\t\u003CText>\n\t\tA\n\t\t\u003CNewline\u002F>\n\t\tB\n\t\t\u003CNewline\u002F>\n\t\tC\n\t\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F   A\n\u002F\u002F   B\n\u002F\u002F X C\n```\n\n##### alignSelf\n\nType: `string`\\\nDefault: `auto`\\\nAllowed values: `auto` `flex-start` `center` `flex-end` `stretch` `baseline`\n\nSee [align-self](https:\u002F\u002Fcss-tricks.com\u002Falmanac\u002Fproperties\u002Fa\u002Falign-self\u002F).\n\n```jsx\n\u003CBox height={3}>\n\t\u003CBox alignSelf=\"flex-start\">\n\t\t\u003CText>X\u003C\u002FText>\n\t\u003C\u002FBox>\n\u003C\u002FBox>\n\u002F\u002F X\n\u002F\u002F\n\u002F\u002F\n\n\u003CBox height={3}>\n\t\u003CBox alignSelf=\"center\">\n\t\t\u003CText>X\u003C\u002FText>\n\t\u003C\u002FBox>\n\u003C\u002FBox>\n\u002F\u002F\n\u002F\u002F X\n\u002F\u002F\n\n\u003CBox height={3}>\n\t\u003CBox alignSelf=\"flex-end\">\n\t\t\u003CText>X\u003C\u002FText>\n\t\u003C\u002FBox>\n\u003C\u002FBox>\n\u002F\u002F\n\u002F\u002F\n\u002F\u002F X\n```\n\n##### alignContent\n\nType: `string`\\\nDefault: `flex-start`\\\nAllowed values: `flex-start` `flex-end` `center` `stretch` `space-between` `space-around` `space-evenly`\n\nDefines alignment between flex lines on the cross axis when `flexWrap` creates multiple lines.\nSee [align-content](https:\u002F\u002Fcss-tricks.com\u002Falmanac\u002Fproperties\u002Fa\u002Falign-content\u002F).\nUnlike CSS (`stretch`), Ink defaults to `flex-start` so wrapped lines stay compact and fixed-height boxes don't gain unexpected empty rows unless you opt in to stretching.\n\n##### justifyContent\n\nType: `string`\\\nAllowed values: `flex-start` `center` `flex-end` `space-between` `space-around` `space-evenly`\n\nSee [justify-content](https:\u002F\u002Fcss-tricks.com\u002Falmanac\u002Fproperties\u002Fj\u002Fjustify-content\u002F).\n\n```jsx\n\u003CBox justifyContent=\"flex-start\">\n\t\u003CText>X\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F [X      ]\n\n\u003CBox justifyContent=\"center\">\n\t\u003CText>X\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F [   X   ]\n\n\u003CBox justifyContent=\"flex-end\">\n\t\u003CText>X\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F [      X]\n\n\u003CBox justifyContent=\"space-between\">\n\t\u003CText>X\u003C\u002FText>\n\t\u003CText>Y\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F [X      Y]\n\n\u003CBox justifyContent=\"space-around\">\n\t\u003CText>X\u003C\u002FText>\n\t\u003CText>Y\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F [  X   Y  ]\n\n\u003CBox justifyContent=\"space-evenly\">\n\t\u003CText>X\u003C\u002FText>\n\t\u003CText>Y\u003C\u002FText>\n\u003C\u002FBox>\n\u002F\u002F [   X   Y   ]\n```\n\n#### Position\n\n##### position\n\nType: `string`\\\nAllowed values: `relative` `absolute` `static`\\\nDefault: `relative`\n\nControls how the element is positioned.\n\nWhen `position` is `static`, `top`, `right`, `bottom`, and `left` are ignored.\n\n##### top\n\nType: `number` `string`\n\nTop offset for positioned elements.\nYou can also set it as a percentage of the parent size.\n\n##### right\n\nType: `number` `string`\n\nRight offset for positioned elements.\nYou can also set it as a percentage of the parent size.\n\n##### bottom\n\nType: `number` `string`\n\nBottom offset for positioned elements.\nYou can also set it as a percentage of the parent size.\n\n##### left\n\nType: `number` `string`\n\nLeft offset for positioned elements.\nYou can also set it as a percentage of the parent size.\n\n#### Visibility\n\n##### display\n\nType: `string`\\\nAllowed values: `flex` `none`\\\nDefault: `flex`\n\nSet this property to `none` to hide the element.\n\n##### overflowX\n\nType: `string`\\\nAllowed values: `visible` `hidden`\\\nDefault: `visible`\n\nBehavior for an element's overflow in the horizontal direction.\n\n##### overflowY\n\nType: `string`\\\nAllowed values: `visible` `hidden`\\\nDefault: `visible`\n\nBehavior for an element's overflow in the vertical direction.\n\n##### overflow\n\nType: `string`\\\nAllowed values: `visible` `hidden`\\\nDefault: `visible`\n\nA shortcut for setting `overflowX` and `overflowY` at the same time.\n\n#### Borders\n\n##### borderStyle\n\nType: `string`\\\nAllowed values: `single` `double` `round` `bold` `singleDouble` `doubleSingle` `classic` | `BoxStyle`\n\nAdd a border with a specified style.\nIf `borderStyle` is `undefined` (the default), no border will be added.\nInk uses border styles from the [`cli-boxes`](https:\u002F\u002Fgithub.com\u002Fsindresorhus\u002Fcli-boxes) module.\n\n```jsx\n\u003CBox flexDirection=\"column\">\n\t\u003CBox>\n\t\t\u003CBox borderStyle=\"single\" marginRight={2}>\n\t\t\t\u003CText>single\u003C\u002FText>\n\t\t\u003C\u002FBox>\n\n\t\t\u003CBox borderStyle=\"double\" marginRight={2}>\n\t\t\t\u003CText>double\u003C\u002FText>\n\t\t\u003C\u002FBox>\n\n\t\t\u003CBox borderStyle=\"round\" marginRight={2}>\n\t\t\t\u003CText>round\u003C\u002FText>\n\t\t\u003C\u002FBox>\n\n\t\t\u003CBox borderStyle=\"bold\">\n\t\t\t\u003CText>bold\u003C\u002FText>\n\t\t\u003C\u002FBox>\n\t\u003C\u002FBox>\n\n\t\u003CBox marginTop={1}>\n\t\t\u003CBox borderStyle=\"singleDouble\" marginRight={2}>\n\t\t\t\u003CText>singleDouble\u003C\u002FText>\n\t\t\u003C\u002FBox>\n\n\t\t\u003CBox borderStyle=\"doubleSingle\" marginRight={2}>\n\t\t\t\u003CText>doubleSingle\u003C\u002FText>\n\t\t\u003C\u002FBox>\n\n\t\t\u003CBox borderStyle=\"classic\">\n\t\t\t\u003CText>classic\u003C\u002FText>\n\t\t\u003C\u002FBox>\n\t\u003C\u002FBox>\n\u003C\u002FBox>\n```\n\n\u003Cimg src=\"media\u002Fbox-borderStyle.jpg\" width=\"521\">\n\nAlternatively, pass a custom border style like so:\n\n```jsx\n\u003CBox\n\tborderStyle={{\n\t\ttopLeft: '↘',\n\t\ttop: '↓',\n\t\ttopRight: '↙',\n\t\tleft: '→',\n\t\tbottomLeft: '↗',\n\t\tbottom: '↑',\n\t\tbottomRight: '↖',\n\t\tright: '←',\n\t}}\n>\n\t\u003CText>Custom\u003C\u002FText>\n\u003C\u002FBox>\n```\n\nSee example in [examples\u002Fborders](examples\u002Fborders\u002Fborders.tsx).\n\n##### borderColor\n\nType: `string`\n\nChange border color.\nA shorthand for setting `borderTopColor`, `borderRightColor`, `borderBottomColor`, and `borderLeftColor`.\n\n```jsx\n\u003CBox borderStyle=\"round\" borderColor=\"green\">\n\t\u003CText>Green Rounded Box\u003C\u002FText>\n\u003C\u002FBox>\n```\n\n\u003Cimg src=\"media\u002Fbox-borderColor.jpg\" width=\"228\">\n\n##### borderTopColor\n\nType: `string`\n\nChange top border color.\nAccepts the same values as [`color`](#color) in `\u003CText>` component.\n\n```jsx\n\u003CBox borderStyle=\"round\" borderTopColor=\"green\">\n\t\u003CText>Hello world\u003C\u002FText>\n\u003C\u002FBox>\n```\n\n##### borderRightColor\n\nType: `string`\n\nChange the right border color.\nAccepts the same values as [`color`](#color) in `\u003CText>` component.\n\n```jsx\n\u003CBox borderStyle=\"round\" borderRightColor=\"green\">\n\t\u003CText>Hello world\u003C\u002FText>\n\u003C\u002FBox>\n```\n\n##### borderBottomColor\n\nType: `string`\n\nChange the bottom border color.\nAccepts the same values as [`color`](#color) in `\u003CText>` component.\n\n```jsx\n\u003CBox borderStyle=\"round\" borderBottomColor=\"green\">\n\t\u003CText>Hello world\u003C\u002FText>\n\u003C\u002FBox>\n```\n\n##### borderLeftColor\n\nType: `string`\n\nChange the left border color.\nAccepts the same values as [`color`](#color) in `\u003CText>` component.\n\n```jsx\n\u003CBox borderStyle=\"round\" borderLeftColor=\"green\">\n\t\u003CText>Hello world\u003C\u002FText>\n\u003C\u002FBox>\n```\n\n##### borderDimColor\n\nType: `boolean`\\\nDefault: `false`\n\nDim the border color.\nA shorthand for setting `borderTopDimColor`, `borderBottomDimColor`, `borderLeftDimColor`, and `borderRightDimColor`.\n\n```jsx\n\u003CBox borderStyle=\"round\" borderDimColor>\n\t\u003CText>Hello world\u003C\u002FText>\n\u003C\u002FBox>\n```\n\n##### borderTopDimColor\n\nType: `boolean`\\\nDefault: `false`\n\nDim the top border color.\n\n```jsx\n\u003CBox borderStyle=\"round\" borderTopDimColor>\n\t\u003CText>Hello world\u003C\u002FText>\n\u003C\u002FBox>\n```\n\n##### borderBottomDimColor\n\nType: `boolean`\\\nDefault: `false`\n\nDim the bottom border color.\n\n```jsx\n\u003CBox borderStyle=\"round\" borderBottomDimColor>\n\t\u003CText>Hello world\u003C\u002FText>\n\u003C\u002FBox>\n```\n\n##### borderLeftDimColor\n\nType: `boolean`\\\nDefault: `false`\n\nDim the left border color.\n\n```jsx\n\u003CBox borderStyle=\"round\" borderLeftDimColor>\n\t\u003CText>Hello world\u003C\u002FText>\n\u003C\u002FBox>\n```\n\n##### borderRightDimColor\n\nType: `boolean`\\\nDefault: `false`\n\nDim the right border color.\n\n```jsx\n\u003CBox borderStyle=\"round\" borderRightDimColor>\n\t\u003CText>Hello world\u003C\u002FText>\n\u003C\u002FBox>\n```\n\n##### borderBackgroundColor\n\nType: `string`\n\nChange border background color.\nAccepts the same values as [`backgroundColor`](#backgroundcolor) in `\u003CText>` component.\nA shorthand for setting `borderTopBackgroundColor`, `borderRightBackgroundColor`, `borderBottomBackgroundColor`, and `borderLeftBackgroundColor`.\n\n```jsx\n\u003CBox borderStyle=\"round\" borderColor=\"white\" borderBackgroundColor=\"green\">\n\t\u003CText>Hello world\u003C\u002FText>\n\u003C\u002FBox>\n```\n\n##### borderTopBackgroundColor\n\nType: `string`\n\nChange top border background color.\nAccepts the same values as [`backgroundColor`](#backgroundcolor) in `\u003CText>` component.\nFalls back to `borderBackgroundColor` if not specified.\n\n```jsx\n\u003CBox borderStyle=\"round\" borderColor=\"white\" borderTopBackgroundColor=\"green\">\n\t\u003CText>Hello world\u003C\u002FText>\n\u003C\u002FBox>\n```\n\n##### borderBottomBackgroundColor\n\nType: `string`\n\nChange bottom border background color.\nAccepts the same values as [`backgroundColor`](#backgroundcolor) in `\u003CText>` component.\nFalls back to `borderBackgroundColor` if not specified.\n\n```jsx\n\u003CBox borderStyle=\"round\" borderColor=\"white\" borderBottomBackgroundColor=\"green\">\n\t\u003CText>Hello world\u003C\u002FText>\n\u003C\u002FBox>\n```\n\n##### borderRightBackgroundColor\n\nType: `string`\n\nChange right border background color.\nAccepts the same values as [`backgroundColor`](#backgroundcolor) in `\u003CText>` component.\nFalls back to `borderBackgroundColor` if not specified.\n\n```jsx\n\u003CBox borderStyle=\"round\" borderColor=\"white\" borderRightBackgroundColor=\"green\">\n\t\u003CText>Hello world\u003C\u002FText>\n\u003C\u002FBox>\n```\n\n##### borderLeftBackgroundColor\n\nType: `string`\n\nChange left border background color.\nAccepts the same values as [`backgroundColor`](#backgroundcolor) in `\u003CText>` component.\nFalls back to `borderBackgroundColor` if not specified.\n\n```jsx\n\u003CBox borderStyle=\"round\" borderColor=\"white\" borderLeftBackgroundColor=\"green\">\n\t\u003CText>Hello world\u003C\u002FText>\n\u003C\u002FBox>\n```\n\n##### borderTop\n\nType: `boolean`\\\nDefault: `true`\n\nDetermines whether the top border is visible.\n\n##### borderRight\n\nType: `boolean`\\\nDefault: `true`\n\nDetermines whether the right border is visible.\n\n##### borderBottom\n\nType: `boolean`\\\nDefault: `true`\n\nDetermines whether the bottom border is visible.\n\n##### borderLeft\n\nType: `boolean`\\\nDefault: `true`\n\nDetermines whether the left border is visible.\n\n#### Background\n\n##### backgroundColor\n\nType: `string`\n\nBackground color for the element.\n\nAccepts the same values as [`color`](#color) in the `\u003CText>` component.\n\n```jsx\n\u003CBox flexDirection=\"column\">\n\t\u003CBox backgroundColor=\"red\" width={20} height={5} alignSelf=\"flex-start\">\n\t\t\u003CText>Red background\u003C\u002FText>\n\t\u003C\u002FBox>\n\n\t\u003CBox\n\t\tbackgroundColor=\"#FF8800\"\n\t\twidth={20}\n\t\theight={3}\n\t\tmarginTop={1}\n\t\talignSelf=\"flex-start\"\n\t>\n\t\t\u003CText>Orange background\u003C\u002FText>\n\t\u003C\u002FBox>\n\n\t\u003CBox\n\t\tbackgroundColor=\"rgb(0, 255, 0)\"\n\t\twidth={20}\n\t\theight={3}\n\t\tmarginTop={1}\n\t\talignSelf=\"flex-start\"\n\t>\n\t\t\u003CText>Green background\u003C\u002FText>\n\t\u003C\u002FBox>\n\u003C\u002FBox>\n```\n\nThe background color fills the entire `\u003CBox>` area and is inherited by child `\u003CText>` components unless they specify their own `backgroundColor`.\n\n```jsx\n\u003CBox backgroundColor=\"blue\" alignSelf=\"flex-start\">\n\t\u003CText>Blue inherited \u003C\u002FText>\n\t\u003CText backgroundColor=\"yellow\">Yellow override \u003C\u002FText>\n\t\u003CText>Blue inherited again\u003C\u002FText>\n\u003C\u002FBox>\n```\n\nBackground colors work with borders and padding:\n\n```jsx\n\u003CBox\n\tbackgroundColor=\"cyan\"\n\tborderStyle=\"round\"\n\tpadding={1}\n\talignSelf=\"flex-start\"\n>\n\t\u003CText>Background with border and padding\u003C\u002FText>\n\u003C\u002FBox>\n```\n\nSee example in [examples\u002Fbox-backgrounds](examples\u002Fbox-backgrounds\u002Fbox-backgrounds.tsx).\n\n### `\u003CNewline>`\n\nAdds one or more newline (`\\n`) characters.\nMust be used within `\u003CText>` components.\n\n#### count\n\nType: `number`\\\nDefault: `1`\n\nNumber of newlines to insert.\n\n```jsx\nimport {render, Text, Newline} from 'ink';\n\nconst Example = () => (\n\t\u003CText>\n\t\t\u003CText color=\"green\">Hello\u003C\u002FText>\n\t\t\u003CNewline \u002F>\n\t\t\u003CText color=\"red\">World\u003C\u002FText>\n\t\u003C\u002FText>\n);\n\nrender(\u003CExample \u002F>);\n```\n\nOutput:\n\n```\nHello\nWorld\n```\n\n### `\u003CSpacer>`\n\nA flexible space that expands along the major axis of its containing layout.\nIt's useful as a shortcut for filling all the available space between elements.\n\nFor example, using `\u003CSpacer>` in a `\u003CBox>` with default flex direction (`row`) will position \"Left\" on the left side and will push \"Right\" to the right side.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\u003CBox>\n\t\t\u003CText>Left\u003C\u002FText>\n\t\t\u003CSpacer \u002F>\n\t\t\u003CText>Right\u003C\u002FText>\n\t\u003C\u002FBox>\n);\n\nrender(\u003CExample \u002F>);\n```\n\nIn a vertical flex direction (`column`), it will position \"Top\" at the top of the container and push \"Bottom\" to the bottom.\nNote that the container needs to be tall enough to see this in effect.\n\n```jsx\nimport {render, Box, Text, Spacer} from 'ink';\n\nconst Example = () => (\n\t\u003CBox flexDirection=\"column\" height={10}>\n\t\t\u003CText>Top\u003C\u002FText>\n\t\t\u003CSpacer \u002F>\n\t\t\u003CText>Bottom\u003C\u002FText>\n\t\u003C\u002FBox>\n);\n\nrender(\u003CExample \u002F>);\n```\n\n### `\u003CStatic>`\n\n`\u003CStatic>` component permanently renders its output above everything else.\nIt's useful for displaying activity like completed tasks or logs - things that\ndon't change after they're rendered (hence the name \"Static\").\n\nIt's preferred to use `\u003CStatic>` for use cases like these when you can't know\nor control the number of items that need to be rendered.\n\nFor example, [Tap](https:\u002F\u002Fgithub.com\u002Ftapjs\u002Fnode-tap) uses `\u003CStatic>` to display\na list of completed tests. [Gatsby](https:\u002F\u002Fgithub.com\u002Fgatsbyjs\u002Fgatsby) uses it\nto display a list of generated pages while still displaying a live progress bar.\n\n```jsx\nimport React, {useState, useEffect} from 'react';\nimport {render, Static, Box, Text} from 'ink';\n\nconst Example = () => {\n\tconst [tests, setTests] = useState([]);\n\n\tuseEffect(() => {\n\t\tlet completedTests = 0;\n\t\tlet timer;\n\n\t\tconst run = () => {\n\t\t\t\u002F\u002F Fake 10 completed tests\n\t\t\tif (completedTests++ \u003C 10) {\n\t\t\t\tsetTests(previousTests => [\n\t\t\t\t\t...previousTests,\n\t\t\t\t\t{\n\t\t\t\t\t\tid: previousTests.length,\n\t\t\t\t\t\ttitle: `Test #${previousTests.length + 1}`,\n\t\t\t\t\t},\n\t\t\t\t]);\n\n\t\t\t\ttimer = setTimeout(run, 100);\n\t\t\t}\n\t\t};\n\n\t\trun();\n\n\t\treturn () => {\n\t\t\tclearTimeout(timer);\n\t\t};\n\t}, []);\n\n\treturn (\n\t\t\u003C>\n\t\t\t{\u002F* This part will be rendered once to the terminal *\u002F}\n\t\t\t\u003CStatic items={tests}>\n\t\t\t\t{test => (\n\t\t\t\t\t\u003CBox key={test.id}>\n\t\t\t\t\t\t\u003CText color=\"green\">✔ {test.title}\u003C\u002FText>\n\t\t\t\t\t\u003C\u002FBox>\n\t\t\t\t)}\n\t\t\t\u003C\u002FStatic>\n\n\t\t\t{\u002F* This part keeps updating as state changes *\u002F}\n\t\t\t\u003CBox marginTop={1}>\n\t\t\t\t\u003CText dimColor>Completed tests: {tests.length}\u003C\u002FText>\n\t\t\t\u003C\u002FBox>\n\t\t\u003C\u002F>\n\t);\n};\n\nrender(\u003CExample \u002F>);\n```\n\n> [!NOTE]\n> `\u003CStatic>` only renders new items in the `items` prop and ignores items that were previously rendered. This means that when you add new items to the `items` array, changes you make to previous items will not trigger a rerender.\n\nSee [examples\u002Fstatic](examples\u002Fstatic\u002Fstatic.tsx) for an example usage of `\u003CStatic>` component.\n\n#### items\n\nType: `Array`\n\nArray of items of any type to render using the function you pass as a component child.\n\n#### style\n\nType: `object`\n\nStyles to apply to a container of child elements.\nSee [`\u003CBox>`](#box) for supported properties.\n\n```jsx\n\u003CStatic items={...} style={{padding: 1}}>\n\t{...}\n\u003C\u002FStatic>\n```\n\n#### children(item)\n\nType: `Function`\n\nFunction that is called to render every item in the `items` array.\nThe first argument is the item itself, and the second argument is the index of that item in the\n`items` array.\n\nNote that a `key` must be assigned to the root component.\n\n```jsx\n\u003CStatic items={['a', 'b', 'c']}>\n\t{(item, index) => {\n\t\t\u002F\u002F This function is called for every item in ['a', 'b', 'c']\n\t\t\u002F\u002F `item` is 'a', 'b', 'c'\n\t\t\u002F\u002F `index` is 0, 1, 2\n\t\treturn (\n\t\t\t\u003CBox key={index}>\n\t\t\t\t\u003CText>Item: {item}\u003C\u002FText>\n\t\t\t\u003C\u002FBox>\n\t\t);\n\t}}\n\u003C\u002FStatic>\n```\n\n### `\u003CTransform>`\n\nTransform a string representation of React components before they're written to output.\nFor example, you might want to apply a [gradient to text](https:\u002F\u002Fgithub.com\u002Fsindresorhus\u002Fink-gradient), [add a clickable link](https:\u002F\u002Fgithub.com\u002Fsindresorhus\u002Fink-link), or [create some text effects](https:\u002F\u002Fgithub.com\u002Fsindresorhus\u002Fink-big-text).\nThese use cases can't accept React nodes as input; they expect a string.\nThat's what the `\u003CTransform>` component does: it gives you an output string of its child components and lets you transform it in any way.\n\n> [!NOTE]\n> `\u003CTransform>` must be applied only to `\u003CText>` children components and shouldn't change the dimensions of the output; otherwise, the layout will be incorrect.\n\n> [!IMPORTANT]\n> When children use `\u003CText>` styling props (e.g. `color`, `bold`), the string passed to `transform` will contain [ANSI escape codes](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FANSI_escape_code). If your transform manipulates whitespace or does string operations like `.trim()`, you may need to use ANSI-aware methods (e.g. from [`slice-ansi`](https:\u002F\u002Fgithub.com\u002Fchalk\u002Fslice-ansi) or [`strip-ansi`](https:\u002F\u002Fgithub.com\u002Fchalk\u002Fstrip-ansi)).\n\n```jsx\nimport {render, Transform} from 'ink';\n\nconst Example = () => (\n\t\u003CTransform transform={output => output.toUpperCase()}>\n\t\t\u003CText>Hello World\u003C\u002FText>\n\t\u003C\u002FTransform>\n);\n\nrender(\u003CExample \u002F>);\n```\n\nSince the `transform` function converts all characters to uppercase, the final output rendered to the terminal will be \"HELLO WORLD\", not \"Hello World\".\n\nWhen the output wraps to multiple lines, it can be helpful to know which line is being processed.\n\nFor example, to implement a hanging indent component, you can indent all the lines except for the first.\n\n```jsx\nimport {render, Transform} from 'ink';\n\nconst HangingIndent = ({indent = 4, children}) => (\n\t\u003CTransform\n\t\ttransform={(line, index) =>\n\t\t\tindex === 0 ? line : ' '.repeat(indent) + line\n\t\t}\n\t>\n\t\t{children}\n\t\u003C\u002FTransform>\n);\n\nconst text =\n\t'WHEN I WROTE the following pages, or rather the bulk of them, ' +\n\t'I lived alone, in the woods, a mile from any neighbor, in a ' +\n\t'house which I had built myself, on the shore of Walden Pond, ' +\n\t'in Concord, Massachusetts, and earned my living by the labor ' +\n\t'of my hands only. I lived there two years and two months. At ' +\n\t'present I am a sojourner in civilized life again.';\n\nrender(\u003CHangingIndent indent={4}>{text}\u003C\u002FHangingIndent>);\n```\n\n#### transform(outputLine, index)\n\nType: `Function`\n\nFunction that transforms children output.\nIt accepts children and must return transformed children as well.\n\n##### children\n\nType: `string`\n\nOutput of child components.\n\n##### index\n\nType: `number`\n\nThe zero-indexed line number of the line that's currently being transformed.\n\n## Hooks\n\n### useInput(inputHandler, options?)\n\nA React hook that returns `void` and handles user input.\nIt's a more convenient alternative to using `useStdin` and listening for `data` events.\nThe callback you pass to `useInput` is called for each character when the user enters any input.\nHowever, if the user pastes text and it's more than one character, the callback will be called only once, and the whole string will be passed as `input`.\nYou can find a full example of using `useInput` at [examples\u002Fuse-input](examples\u002Fuse-input\u002Fuse-input.tsx).\n\n```jsx\nimport {useInput} from 'ink';\n\nconst UserInput = () => {\n\tuseInput((input, key) => {\n\t\tif (input === 'q') {\n\t\t\t\u002F\u002F Exit program\n\t\t}\n\n\t\tif (key.leftArrow) {\n\t\t\t\u002F\u002F Left arrow key pressed\n\t\t}\n\t});\n\n\treturn …\n};\n```\n\n#### inputHandler(input, key)\n\nType: `Function`\n\nThe handler function that you pass to `useInput` receives two arguments:\n\n##### input\n\nType: `string`\n\nThe input that the program received.\n\n##### key\n\nType: `object`\n\nHandy information about a key that was pressed.\n\n###### key.leftArrow\n\n###### key.rightArrow\n\n###### key.upArrow\n\n###### key.downArrow\n\nType: `boolean`\\\nDefault: `false`\n\nIf an arrow key was pressed, the corresponding property will be `true`.\nFor example, if the user presses the left arrow key, `key.leftArrow` equals `true`.\n\n###### key.return\n\nType: `boolean`\\\nDefault: `false`\n\nReturn (Enter) key was pressed.\n\n###### key.escape\n\nType: `boolean`\\\nDefault: `false`\n\nEscape key was pressed.\n\n###### key.ctrl\n\nType: `boolean`\\\nDefault: `false`\n\nCtrl key was pressed.\n\n###### key.shift\n\nType: `boolean`\\\nDefault: `false`\n\nShift key was pressed.\n\n###### key.tab\n\nType: `boolean`\\\nDefault: `false`\n\nTab key was pressed.\n\n###### key.backspace\n\nType: `boolean`\\\nDefault: `false`\n\nBackspace key was pressed.\n\n###### key.delete\n\nType: `boolean`\\\nDefault: `false`\n\nDelete key was pressed.\n\n###### key.pageDown\n\n###### key.pageUp\n\nType: `boolean`\\\nDefault: `false`\n\nIf the Page Up or Page Down key was pressed, the corresponding property will be `true`.\nFor example, if the user presses Page Down, `key.pageDown` equals `true`.\n\n###### key.home\n\n###### key.end\n\nType: `boolean`\\\nDefault: `false`\n\nIf the Home or End key was pressed, the corresponding property will be `true`.\nFor example, if the user presses End, `key.end` equals `true`.\n\n###### key.meta\n\nType: `boolean`\\\nDefault: `false`\n\n[Meta key](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FMeta_key) was pressed.\n\n###### key.super\n\nType: `boolean`\\\nDefault: `false`\n\nSuper key (Cmd on macOS, Win on Windows) was pressed. Requires [kitty keyboard protocol](#kittykeyboard).\n\n###### key.hyper\n\nType: `boolean`\\\nDefault: `false`\n\nHyper key was pressed. Requires [kitty keyboard protocol](#kittykeyboard).\n\n###### key.capsLock\n\nType: `boolean`\\\nDefault: `false`\n\nCaps Lock was active. Requires [kitty keyboard protocol](#kittykeyboard).\n\n###### key.numLock\n\nType: `boolean`\\\nDefault: `false`\n\nNum Lock was active. Requires [kitty keyboard protocol](#kittykeyboard).\n\n###### key.eventType\n\nType: `'press' | 'repeat' | 'release'`\\\nDefault: `undefined`\n\nThe type of key event. Only available with [kitty keyboard protocol](#kittykeyboard). Without the protocol, this property is `undefined`.\n\n#### options\n\nType: `object`\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable capturing of user input.\nUseful when there are multiple `useInput` hooks used at once to avoid handling the same input several times.\n\n### usePaste(handler, options?)\n\nA React hook that calls `handler` whenever the user pastes text. Bracketed paste mode (`\\x1b[?2004h`) is automatically enabled while the hook is active, so pasted text arrives as a single string rather than being misinterpreted as individual key presses.\n\n`usePaste` and `useInput` can be used together in the same component. They operate on separate event channels, so paste content is never forwarded to `useInput` handlers when `usePaste` is active.\n\n```jsx\nimport {useInput, usePaste} from 'ink';\n\nconst MyInput = () => {\n\tuseInput((input, key) => {\n\t\t\u002F\u002F Only receives typed characters and key events, not pasted text.\n\t\tif (key.return) {\n\t\t\t\u002F\u002F Submit\n\t\t}\n\t});\n\n\tusePaste((text) => {\n\t\t\u002F\u002F Receives the full pasted string, including newlines.\n\t\tconsole.log('Pasted:', text);\n\t});\n\n\treturn …\n};\n```\n\n#### handler(text)\n\nType: `Function`\n\nCalled with the full pasted string whenever the user pastes text. The string is delivered verbatim — newlines, escape sequences, and other special characters are preserved exactly as pasted.\n\n##### text\n\nType: `string`\n\nThe pasted text.\n\n#### options\n\nType: `object`\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable the paste handler. Useful when multiple components use `usePaste` and only one should be active at a time.\n\n### useApp()\n\nA React hook that returns app lifecycle methods.\n\n#### exit(errorOrResult?)\n\nType: `Function`\n\nExit (unmount) the whole Ink app.\n\n##### errorOrResult\n\nType: `Error | unknown`\n\nOptional value that controls how [`waitUntilExit`](#waituntilexit) settles:\n\n- `exit()` resolves with `undefined`.\n- `exit(error)` rejects when `error` is an `Error`.\n- `exit(value)` resolves with `value`.\n\n```js\nimport {useEffect} from 'react';\nimport {useApp} from 'ink';\n\nconst Example = () => {\n\tconst {exit} = useApp();\n\n\t\u002F\u002F Exit the app after 5 seconds\n\tuseEffect(() => {\n\t\tsetTimeout(() => {\n\t\t\texit();\n\t\t}, 5000);\n\t}, [exit]);\n\n\treturn …\n};\n```\n\n#### waitUntilRenderFlush()\n\nType: `Function`\n\nReturns a promise that settles after pending render output is flushed to stdout.\n\n```js\nimport {useEffect} from 'react';\nimport {useApp} from 'ink';\n\nconst Example = () => {\n\tconst {waitUntilRenderFlush} = useApp();\n\n\tuseEffect(() => {\n\t\tvoid (async () => {\n\t\t\tawait waitUntilRenderFlush();\n\t\t\trunNextCommand();\n\t\t})();\n\t}, [waitUntilRenderFlush]);\n\n\treturn …;\n};\n```\n\n### useStdin()\n\nA React hook that returns the stdin stream and stdin-related utilities.\n\n#### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nThe stdin stream passed to `render()` in `options.stdin`, or `process.stdin` by default.\nUseful if your app needs to handle user input.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {stdin} = useStdin();\n\n\treturn …\n};\n```\n\n#### isRawModeSupported\n\nType: `boolean`\n\nA boolean flag determining if the current `stdin` supports `setRawMode`.\nA component using `setRawMode` might want to use `isRawModeSupported` to nicely fall back in environments where raw mode is not supported.\n\n```jsx\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {isRawModeSupported} = useStdin();\n\n\treturn isRawModeSupported ? (\n\t\t\u003CMyInputComponent \u002F>\n\t) : (\n\t\t\u003CMyComponentThatDoesntUseInput \u002F>\n\t);\n};\n```\n\n#### setRawMode(isRawModeEnabled)\n\nType: `function`\n\n##### isRawModeEnabled\n\nType: `boolean`\n\nSee [`setRawMode`](https:\u002F\u002Fnodejs.org\u002Fapi\u002Ftty.html#tty_readstream_setrawmode_mode).\nInk exposes this function to be able to handle \u003Ckbd>Ctrl\u003C\u002Fkbd>+\u003Ckbd>C\u003C\u002Fkbd>, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.\n\n**Warning:** This function will throw unless the current `stdin` supports `setRawMode`. Use [`isRawModeSupported`](#israwmodesupported) to detect `setRawMode` support.\n\n```js\nimport {useStdin} from 'ink';\n\nconst Example = () => {\n\tconst {setRawMode} = useStdin();\n\n\tuseEffect(() => {\n\t\tsetRawMode(true);\n\n\t\treturn () => {\n\t\t\tsetRawMode(false);\n\t\t};\n\t});\n\n\treturn …\n};\n```\n\n### useStdout()\n\nA React hook that returns the stdout stream where Ink renders your app and stdout-related utilities.\n\n#### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {stdout} = useStdout();\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stdout while preserving Ink's output.\nIt's useful when you want to display external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to `\u003CStatic>`, except it can't accept components; it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stdout.\n\n```js\nimport {useStdout} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStdout();\n\n\tuseEffect(() => {\n\t\t\u002F\u002F Write a single message to stdout, above Ink's output\n\t\twrite('Hello from Ink to stdout\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\nSee additional usage example in [examples\u002Fuse-stdout](examples\u002Fuse-stdout\u002Fuse-stdout.tsx).\n\n### useBoxMetrics(ref)\n\nA React hook that returns the current layout metrics for a tracked box element.\nIt updates when layout changes (for example terminal resize, sibling\u002Fcontent changes, or position changes).\n\nUse `hasMeasured` to detect when the currently tracked element has been measured.\n\n#### ref\n\nType: `React.RefObject\u003CDOMElement>`\n\nA ref to the `\u003CBox>` element to track.\n\n```jsx\nimport {useRef} from 'react';\nimport {Box, Text, useBoxMetrics} from 'ink';\n\nconst Example = () => {\n\tconst ref = useRef(null);\n\tconst {width, height, left, top, hasMeasured} = useBoxMetrics(ref);\n\n\treturn (\n\t\t\u003CBox ref={ref}>\n\t\t\t\u003CText>\n\t\t\t\t{hasMeasured ? `${width}x${height} at ${left},${top}` : 'Measuring...'}\n\t\t\t\u003C\u002FText>\n\t\t\u003C\u002FBox>\n\t);\n};\n```\n\n#### width\n\nType: `number`\n\nElement width.\n\n#### height\n\nType: `number`\n\nElement height.\n\n#### left\n\nType: `number`\n\nDistance from the left edge of the parent.\n\n#### top\n\nType: `number`\n\nDistance from the top edge of the parent.\n\n#### hasMeasured\n\nType: `boolean`\n\nWhether the currently tracked element has been measured.\n\n> [!NOTE]\n> The hook returns `{width: 0, height: 0, left: 0, top: 0}` until the first layout pass completes. It also returns zeros when the tracked ref is detached.\n\n### useStderr()\n\nA React hook that returns the stderr stream and stderr-related utilities.\n\n#### stderr\n\nType: `stream.Writable`\\\nDefault: `process.stderr`\n\nStderr stream.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {stderr} = useStderr();\n\n\treturn …\n};\n```\n\n#### write(data)\n\nWrite any string to stderr while preserving Ink's output.\n\nIt's useful when you want to display external information outside of Ink's rendering and ensure there's no conflict between the two.\nIt's similar to `\u003CStatic>`, except it can't accept components; it only works with strings.\n\n##### data\n\nType: `string`\n\nData to write to stderr.\n\n```js\nimport {useStderr} from 'ink';\n\nconst Example = () => {\n\tconst {write} = useStderr();\n\n\tuseEffect(() => {\n\t\t\u002F\u002F Write a single message to stderr, above Ink's output\n\t\twrite('Hello from Ink to stderr\\n');\n\t}, []);\n\n\treturn …\n};\n```\n\n### useWindowSize()\n\nA React hook that returns the current terminal dimensions and re-renders the component whenever the terminal is resized.\n\n```js\nimport {Text, useWindowSize} from 'ink';\n\nconst Example = () => {\n\tconst {columns, rows} = useWindowSize();\n\n\treturn (\n\t\t\u003CText>\n\t\t\t{columns}x{rows}\n\t\t\u003C\u002FText>\n\t);\n};\n```\n\n#### columns\n\nType: `number`\n\nNumber of columns (horizontal character cells).\n\n#### rows\n\nType: `number`\n\nNumber of rows (vertical character cells).\n\n> [!NOTE]\n> When the terminal is resized narrower, ghost lines may briefly appear depending on the terminal emulator's reflow behavior.\n\n### useFocus(options?)\n\nA React hook that returns focus state and focus controls for the current component.\nA component that uses the `useFocus` hook becomes \"focusable\" to Ink, so when the user presses \u003Ckbd>Tab\u003C\u002Fkbd>, Ink will switch focus to this component.\nIf there are multiple components that execute the `useFocus` hook, focus will be given to them in the order in which these components are rendered.\nThis hook returns an object with an `isFocused` boolean property, which determines whether this component is focused.\n\n#### options\n\n##### autoFocus\n\nType: `boolean`\\\nDefault: `false`\n\nAuto-focus this component if there's no active (focused) component right now.\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nEnable or disable this component's focus, while still maintaining its position in the list of focusable components.\nThis is useful for inputs that are temporarily disabled.\n\n##### id\n\nType: `string`\\\nRequired: `false`\n\nSet a component's focus ID, which can be used to programmatically focus the component. This is useful for large interfaces with many focusable elements to avoid having to cycle through all of them.\n\n```jsx\nimport {render, useFocus, Text} from 'ink';\n\nconst Example = () => {\n\tconst {isFocused} = useFocus();\n\n\treturn \u003CText>{isFocused ? 'I am focused' : 'I am not focused'}\u003C\u002FText>;\n};\n\nrender(\u003CExample \u002F>);\n```\n\nSee example in [examples\u002Fuse-focus](examples\u002Fuse-focus\u002Fuse-focus.tsx) and [examples\u002Fuse-focus-with-id](examples\u002Fuse-focus-with-id\u002Fuse-focus-with-id.tsx).\n\n### useFocusManager()\n\nA React hook that returns methods to manage focus across focusable components.\n\n#### enableFocus()\n\nEnable focus management for all components.\n\n> [!NOTE]\n> You don't need to call this method manually unless you've disabled focus management. Focus management is enabled by default.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {enableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tenableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### disableFocus()\n\nDisable focus management for all components.\nThe currently active component (if there's one) will lose its focus.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {disableFocus} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tdisableFocus();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusNext()\n\nSwitch focus to the next focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf the active component is the last in the list of focusable components, focus will be switched to the first focusable component.\n\n> [!NOTE]\n> Ink calls this method when user presses \u003Ckbd>Tab\u003C\u002Fkbd>.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusNext} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusNext();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focusPrevious()\n\nSwitch focus to the previous focusable component.\nIf there's no active component right now, focus will be given to the first focusable component.\nIf the active component is the first in the list of focusable components, focus will be switched to the last focusable component.\n\n> [!NOTE]\n> Ink calls this method when user presses \u003Ckbd>Shift\u003C\u002Fkbd>+\u003Ckbd>Tab\u003C\u002Fkbd>.\n\n```js\nimport {useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {focusPrevious} = useFocusManager();\n\n\tuseEffect(() => {\n\t\tfocusPrevious();\n\t}, []);\n\n\treturn …\n};\n```\n\n#### focus(id)\n\n##### id\n\nType: `string`\n\nSwitch focus to the component with the given [`id`](#id).\nIf there's no component with that ID, focus is not changed.\n\n```js\nimport {useFocusManager, useInput} from 'ink';\n\nconst Example = () => {\n\tconst {focus} = useFocusManager();\n\n\tuseInput(input => {\n\t\tif (input === 's') {\n\t\t\t\u002F\u002F Focus the component with focus ID 'someId'\n\t\t\tfocus('someId');\n\t\t}\n\t});\n\n\treturn …\n};\n```\n\n#### activeId\n\nType: `string | undefined`\n\nThe ID of the currently focused component, or `undefined` if no component is focused.\n\n```js\nimport {Text, useFocusManager} from 'ink';\n\nconst Example = () => {\n\tconst {activeId} = useFocusManager();\n\n\treturn \u003CText>Focused: {activeId ?? 'none'}\u003C\u002FText>;\n};\n```\n\n### useCursor()\n\nA React hook that returns methods to control the terminal cursor position after each render.\nThis is essential for IME (Input Method Editor) support, where the composing character is displayed at the cursor location.\n\n```jsx\nimport {useState} from 'react';\nimport {Box, Text, useCursor} from 'ink';\nimport stringWidth from 'string-width';\n\nconst TextInput = () => {\n\tconst [text, setText] = useState('');\n\tconst {setCursorPosition} = useCursor();\n\n\tconst prompt = '> ';\n\tsetCursorPosition({x: stringWidth(prompt + text), y: 1});\n\n\treturn (\n\t\t\u003CBox flexDirection=\"column\">\n\t\t\t\u003CText>Type here:\u003C\u002FText>\n\t\t\t\u003CText>\n\t\t\t\t{prompt}\n\t\t\t\t{text}\n\t\t\t\u003C\u002FText>\n\t\t\u003C\u002FBox>\n\t);\n};\n```\n\n#### setCursorPosition(position)\n\nSet the cursor position relative to the Ink output. Pass `undefined` to hide the cursor.\n\n##### position\n\nType: `object | undefined`\n\nUse [`string-width`](https:\u002F\u002Fgithub.com\u002Fsindresorhus\u002Fstring-width) to calculate `x` for strings containing wide characters (CJK, emoji).\n\nSee a full example at [examples\u002Fcursor-ime](examples\u002Fcursor-ime\u002Fcursor-ime.tsx).\n\n###### x\n\nType: `number`\n\nColumn position (0-based).\n\n###### y\n\nType: `number`\n\nRow position from the top of the Ink output (0 = first line).\n\n### useIsScreenReaderEnabled()\n\nA React hook that returns whether a screen reader is enabled.\nThis is useful when you want to render different output for screen readers.\n\n```jsx\nimport {useIsScreenReaderEnabled, Text} from 'ink';\n\nconst Example = () => {\n\tconst isScreenReaderEnabled = useIsScreenReaderEnabled();\n\n\treturn (\n\t\t\u003CText>\n\t\t\t{isScreenReaderEnabled\n\t\t\t\t? 'Screen reader is enabled'\n\t\t\t\t: 'Screen reader is disabled'}\n\t\t\u003C\u002FText>\n\t);\n};\n```\n\n### useAnimation(options?)\n\nA React hook that drives animations. Returns a frame counter, elapsed time, frame delta, and a reset function. All animations share a single timer internally, so multiple animated components consolidate into one render cycle.\n\n```jsx\nimport {Text, useAnimation} from 'ink';\n\nconst Spinner = () => {\n\tconst {frame} = useAnimation({interval: 80});\n\tconst characters = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\n\n\treturn \u003CText>{characters[frame % characters.length]}\u003C\u002FText>;\n};\n```\n\n#### options\n\nType: `object`\n\n##### interval\n\nType: `number`\\\nDefault: `100`\n\nTime between ticks in milliseconds.\n\n##### isActive\n\nType: `boolean`\\\nDefault: `true`\n\nWhether the animation is running. When set to `false`, the animation stops. When toggled back to `true`, all values reset to `0`.\n\n#### Return value\n\n##### frame\n\nType: `number`\n\nDiscrete counter that increments by 1 each interval. Useful for indexed sequences like spinner frames.\n\n##### time\n\nType: `number`\n\nTotal elapsed time in milliseconds since the animation started or was last reset. Useful for continuous math-based animations like sine waves: `Math.sin(time \u002F 1000 * Math.PI * 2)`.\n\n##### delta\n\nType: `number`\n\nTime in milliseconds since the previous rendered tick. Accounts for throttled renders. Useful for physics-based or velocity-driven motion: `position += speed * delta`.\n\n##### reset\n\nType: `() => void`\n\nResets `frame`, `time`, and `delta` to `0` and restarts timing from the current moment. Useful for one-shot animations triggered by events.\n\n## API\n\n#### render(tree, options?)\n\nReturns: [`Instance`](#instance)\n\nMount a component and render the output.\n\n##### tree\n\nType: `ReactNode`\n\n##### options\n\nType: `object`\n\n###### stdout\n\nType: `stream.Writable`\\\nDefault: `process.stdout`\n\nOutput stream where the app will be rendered.\n\n###### stdin\n\nType: `stream.Readable`\\\nDefault: `process.stdin`\n\nInput stream where app will listen for input.\n\n###### stderr\n\nType: `stream.Writable`\\\nDefault: `process.stderr`\n\nError stream.\n\n###### exitOnCtrlC\n\nType: `boolean`\\\nDefault: `true`\n\nConfigure whether Ink should listen for Ctrl+C keyboard input and exit the app.\nThis is needed in case `process.stdin` is in [raw mode](https:\u002F\u002Fnodejs.org\u002Fapi\u002Ftty.html#tty_readstream_setrawmode_mode), because then Ctrl+C is ignored by default and the process is expected to handle it manually.\n\n###### patchConsole\n\nType: `boolean`\\\nDefault: `true`\n\nPatch console methods to ensure console output doesn't mix with Ink's output.\nWhen any of the `console.*` methods are called (like `console.log()`), Ink intercepts their output, clears the main output, renders output from the console method, and then rerenders the main output again.\nThat way, both are visible and don't overlap each other.\n\nOnce unmount starts, Ink restores the native console before React cleanup runs. Teardown-time `console.*` output then follows the normal console behavior instead of being rerouted through Ink.\n\nThis functionality is powered by [patch-console](https:\u002F\u002Fgithub.com\u002Fvadimdemedes\u002Fpatch-console), so if you need to disable Ink's interception of output but want to build something custom, you can use that.\n\n###### onRender\n\nType: `({renderTime: number}) => void`\\\nDefault: `undefined`\n\nRuns the given callback after each render and re-render with render metrics.\nThis callback runs after Ink commits a frame, but it does not wait for `stdout`\u002F`stderr` stream callbacks.\nTo run code after output is flushed, use [`waitUntilRenderFlush()`](#waituntilrenderflush).\n\n###### isScreenReaderEnabled\n\nType: `boolean`\\\nDefault: `process.env['INK_SCREEN_READER'] === 'true'`\n\nEnable screen reader support. See [Screen Reader Support](#screen-reader-support).\n\n###### debug\n\nType: `boolean`\\\nDefault: `false`\n\nIf `true`, each update will be rendered as separate output, without replacing the previous one.\n\n###### maxFps\n\nType: `number`\\\nDefault: `30`\n\nMaximum frames per second for render updates.\nThis controls how frequently the UI can update to prevent excessive re-rendering.\nHigher values allow more frequent updates but may impact performance.\nSetting it to a lower value may be useful for components that update very frequently, to reduce CPU usage.\n\n###### incrementalRendering\n\nType: `boolean`\\\nDefault: `false`\n\nEnable incremental rendering mode which only updates changed lines instead of redrawing the entire output.\nThis can reduce flickering and improve performance for frequently updating UIs.\n\n###### concurrent\n\nType: `boolean`\\\nDefault: `false`\n\nEnable React Concurrent Rendering mode.\n\nWhen enabled:\n\n- Suspense boundaries work correctly with async data fetching\n- `useTransition` and `useDeferredValue` hooks are fully functional\n- Updates can be interrupted for higher priority work\n\n```jsx\nrender(\u003CMyApp \u002F>, {concurrent: true});\n```\n\n> [!NOTE]\n> Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change the rendering mode or create a fresh instance.\n\n###### interactive\n\nType: `boolean`\\\nDefault: `true` (`false` if in CI (detected via [`is-in-ci`](https:\u002F\u002Fgithub.com\u002Fsindresorhus\u002Fis-in-ci)) or `stdout.isTTY` is falsy)\n\nOverride automatic interactive mode detection.\n\nBy default, Ink detects whether the environment is interactive based on CI detection and `stdout.isTTY`. When non-interactive, Ink skips terminal-specific features like ANSI erase sequences, cursor manipulation, synchronized output, resize handling, and kitty keyboard auto-detection. Only the final frame of non-static output is written at unmount.\n\nMost users should not need to set this option. Use it when you have your own \"interactive\" detection logic that differs from the built-in behavior.\n\n> [!NOTE]\n> Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.\n\n```jsx\n\u002F\u002F Use your own detection logic\nconst isInteractive = myCustomDetection();\nrender(\u003CMyApp \u002F>, {interactive: isInteractive});\n```\n\n###### alternateScreen\n\nType: `boolean`\\\nDefault: `false`\n\nRender the app in the terminal's alternate screen buffer. When enabled, the app renders on a separate screen, and the original terminal content is restored when the app exits. This is the same mechanism used by programs like vim, htop, and less.\n\nNote: The terminal's scrollback buffer is not available while in the alternate screen. This is standard terminal behavior; programs like vim use the alternate screen specifically to avoid polluting the user's scrollback history.\n\nInk intentionally treats alternate-screen teardown output as disposable. It does not preserve or replay teardown-time frames, hook writes, or `console.*` output after restoring the primary screen.\n\nOnly works in interactive mode. Ignored when `interactive` is `false` or in a non-interactive environment (CI, piped stdout).\n\n> [!NOTE]\n> Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.\n\n```jsx\nrender(\u003CMyApp \u002F>, {alternateScreen: true});\n```\n\n###### kittyKeyboard\n\nType: `object`\\\nDefault: `undefined`\n\nEnable the [kitty keyboard protocol](https:\u002F\u002Fsw.kovidgoyal.net\u002Fkitty\u002Fkeyboard-protocol\u002F) for enhanced keyboard input handling. When enabled, terminals that support the protocol will report additional key information including `super`, `hyper`, `capsLock`, `numLock` modifiers and `eventType` (press\u002Frepeat\u002Frelease).\n\n```jsx\nimport {render} from 'ink';\n\nrender(\u003CMyApp \u002F>, {kittyKeyboard: {mode: 'auto'}});\n```\n\n```jsx\nimport {render} from 'ink';\n\nrender(\u003CMyApp \u002F>, {\n\tkittyKeyboard: {\n\t\tmode: 'enabled',\n\t\tflags: ['disambiguateEscapeCodes', 'reportEventTypes'],\n\t},\n});\n```\n\n**kittyKeyboard.mode**\n\nType: `'auto' | 'enabled' | 'disabled'`\\\nDefault: `'auto'`\n\n- `'auto'`: Detect terminal support using a heuristic precheck (known terminals like kitty, WezTerm, Ghostty) followed by a protocol query confirmation (`CSI ? u`). The protocol is only enabled if the terminal responds to the query within a short timeout.\n- `'enabled'`: Force enable the protocol. Both stdin and stdout must be TTYs.\n- `'disabled'`: Never enable the protocol.\n\n**kittyKeyboard.flags**\n\nType: `string[]`\\\nDefault: `['disambiguateEscapeCodes']`\n\nProtocol flags to request from the terminal. Pass an array of flag name strings.\n\nAvailable flags:\n\n- `'disambiguateEscapeCodes'` - Disambiguate escape codes\n- `'reportEventTypes'` - Report key press, repeat, and release events\n- `'reportAlternateKeys'` - Report alternate key encodings\n- `'reportAllKeysAsEscapeCodes'` - Report all keys as escape codes\n- `'reportAssociatedText'` - Report associated text with key events\n\n**Behavior notes**\n\nWhen the kitty keyboard protocol is enabled, input handling changes in several ways:\n\n- **Non-printable keys produce empty input.** Keys like function keys (F1-F35), modifier-only keys (Shift, Control, Super), media keys, Caps Lock, Print Screen, and similar keys will not produce any text in the `input` parameter of `useInput`. They can still be detected via the `key` object properties.\n- **Ctrl+letter shortcuts work as expected.** When the terminal sends `Ctrl+letter` as codepoint 1-26 (the kitty CSI-u alternate form), `input` is set to the letter name (e.g. `'c'` for `Ctrl+C`) and `key.ctrl` is `true`. This ensures `exitOnCtrlC` and custom `Ctrl+letter` handlers continue to work regardless of which codepoint form the terminal uses.\n- **Key disambiguation.** The protocol allows the terminal to distinguish between keys that normally produce the same escape sequence. For examp","Ink 是一个用于构建交互式命令行应用程序的 React 框架。它允许开发者使用熟悉的 React 组件来创建和测试 CLI 输出，并通过 Yoga 引擎支持 Flexbox 布局，使得许多类似 CSS 的属性在 Ink 中可用。这非常适合那些希望利用 React 生态系统优势同时开发高效、美观命令行工具的场景。无论是进行自动化脚本编写、日志查看还是任何需要图形化界面辅助的终端操作，Ink 都能提供强大的支持。",2,"2026-06-11 02:43:15","top_all"]