{"_id":"@3z3qu13l/inquirer-tree-prompt","name":"@3z3qu13l/inquirer-tree-prompt","dist-tags":{"latest":"4.2.0"},"versions":{"4.2.0":{"name":"@3z3qu13l/inquirer-tree-prompt","version":"4.2.0","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/3z3qu13l/inquirer-tree-prompt.git"},"homepage":"https://github.com/3z3qu13l/inquirer-tree-prompt#readme","bugs":{"url":"https://github.com/3z3qu13l/inquirer-tree-prompt/issues"},"author":{"name":"3z3qu13l","url":"https://github.com/3z3qu13l"},"keywords":["inquirer","inquirer-prompt","prompt","tree","cli","command-line","menu"],"engines":{"node":">=22"},"scripts":{"lint":"eslint .","lint:fix":"eslint --fix .","test":"node --test \"test/**/*.test.js\""},"type":"module","description":"Inquirer tree prompt","main":"index.js","exports":"./index.js","license":"ISC","dependencies":{"figures":"6.1.0","yoctocolors":"2.2.0"},"peerDependencies":{"@inquirer/core":">=10"},"devDependencies":{"@eslint/js":"10.0.1","@inquirer/core":"11.2.1","eslint":"10.8.0","globals":"17.9.0"},"gitHead":"7ab5900162be39fd0b8e9fb303e205d2301e8cb9","_id":"@3z3qu13l/inquirer-tree-prompt@4.2.0","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-eYeY+4WESBc/Dzv0ZXpXVSJQyJlsD7Pf7Vb7vrRWUfw+8rQ8HQDlwlWwkTvZTAhw27y4yCkD84CyGAs0+VnOAw==","shasum":"aa5c968c3abe50656ce5ef3b32e9c7f26076ce05","tarball":"https://registry.npmjs.org/@3z3qu13l/inquirer-tree-prompt/-/inquirer-tree-prompt-4.2.0.tgz","fileCount":5,"unpackedSize":22408,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCnPcR5viOzZ2suoRg/L1R+/zXqq437W+PL3+Z6HVG45QIgdT56l/0WUK1vk6uhvQu39EfjXmOgnnOTUifkf8shrKA="}]},"_npmUser":{"name":"3z3qu13l","email":"shawilelol@protonmail.com"},"directories":{},"maintainers":[{"name":"3z3qu13l","email":"shawilelol@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/inquirer-tree-prompt_4.2.0_1785943141450_0.9393377868206634"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-05T15:19:01.271Z","4.2.0":"2026-08-05T15:19:01.622Z","modified":"2026-08-05T15:19:01.840Z"},"maintainers":[{"name":"3z3qu13l","email":"shawilelol@protonmail.com"}],"description":"Inquirer tree prompt","homepage":"https://github.com/3z3qu13l/inquirer-tree-prompt#readme","keywords":["inquirer","inquirer-prompt","prompt","tree","cli","command-line","menu"],"repository":{"type":"git","url":"git+https://github.com/3z3qu13l/inquirer-tree-prompt.git"},"author":{"name":"3z3qu13l","url":"https://github.com/3z3qu13l"},"bugs":{"url":"https://github.com/3z3qu13l/inquirer-tree-prompt/issues"},"license":"ISC","readme":"## Inquirer Tree Prompt\n\nCode base forked from [inquirer-tree-prompt](https://github.com/insightfuls/inquirer-tree-prompt)\n\n### QuickDemo\n![QuickDemo](./example/screenshot.gif)\n\n### Install\n```\nnpm install @3z3qu13l/inquirer-tree-prompt\n```\n\nRequires Node.js >= 22 and `@inquirer/core` >= 10 as a peer dependency.\n\n### Usage\nThe prompt is a standalone `@inquirer/core` prompt: call it directly and await\nthe answer.\n\n```js\nimport { treePrompt } from '@3z3qu13l/inquirer-tree-prompt';\n\nconst answer = await treePrompt({\n    message: 'Where is my phone?',\n    tree: [/* ... */],\n});\n```\n\n### Options\nTakes `message`, `tree`, [`filter`, `validate`, `transformer`, `pageSize`, `loop`, `onlyShowValid`, `hideChildrenOfValid`, `multiple`] properties.\n\n- `message`: (String) the question to display.\n\n- `tree`: (Array or Function) list of tree items, or an (optionally asynchronous) function returning them; items are strings or objects with:\n  - `name`: (String) to display in list; must provide this or `value`. It may span several lines: the extra lines are indented under the first one and count towards `pageSize`\n  - `value`: (String) to put in answers hash; must provide this or `name`\n  - `short`: (String) to display after selection\n  - `open`: (Boolean) whether the item is expanded or collapsed\n  - `isValid`: (Boolean) skips `validate` for this item\n  - `multiple`: (Boolean) whether this item's children may be selected together (only meaningful when the prompt is in `multiple` mode); children are mutually exclusive by default\n  - `children`: (Array or Function) list of child tree items, or an (optionally asynchronous) function returning them. The function may return a list of children, or a replacement item (`{ name, value, short, children }`) when the item itself has to be updated once resolved.\n\n- `validate`: (Function) receives an item's value, returns (or resolves to) whether it may be selected. Invalid items are shown in red and cannot be confirmed.\n\n- `onlyShowValid`: (Boolean) if true, will only show valid items (if `validate` is provided); items with children are kept since they may contain valid descendants. Default: false.\n\n- `hideChildrenOfValid`: (Boolean) if true, will hide children of valid items (if `validate` is provided). Default: false.\n\n- `transformer`: (Function) a hook function to transform the display of item's value (when `name` is not given).\n\n- `filter`: (Function) receives the answer (a value, or an array of values in `multiple` mode) and returns (or resolves to) the value to answer with.\n\n- `multiple`: (Boolean) if true, will enable to select multiple items. Default: false.\n\n- `pageSize`: (Number) number of **rows** displayed at once. Default: 10. A name spanning several lines takes that many rows off the page, and the page is capped to the height of the terminal so the highlighted item always stays visible.\n\n- `loop`: (Boolean) if true, moving past the last item wraps around to the first. Default: true.\n\n### Keys\n- `up` / `down`: move through the visible items\n- `right`: expand the item, or move to its first child when already expanded; toggles selection on a leaf in `multiple` mode\n- `left`: collapse the item, or move to its parent\n- `space`: toggle selection in `multiple` mode, otherwise expand or collapse\n- `tab`: expand or collapse\n- `enter`: confirm\n\n### Example\n```js\nimport { treePrompt } from '@3z3qu13l/inquirer-tree-prompt';\n\nconst answer = await treePrompt({\n    message: 'Where is my phone?',\n    tree: [\n        {\n            value: \"in the house\",\n            open: true,\n            children: [\n                {\n                    value: \"in the living room\",\n                    children: [\n                        \"on the sofa\",\n                        \"on the TV cabinet\"\n                    ]\n                },\n                {\n                    value: \"in the bedroom\",\n                    children: [\n                        \"under the bedclothes\",\n                        \"on the bedside table\"\n                    ]\n                },\n                \"in the bathroom\"\n            ]\n        },\n        {\n            value: \"in the car\",\n            // resolved the first time the item is expanded\n            children: async () => [\n                \"on the dash\",\n                \"in the compartment\",\n                \"on the seat\"\n            ]\n        }\n    ]\n});\n\nconsole.log(answer);\n```\n\n### Examples\nThe [`example`](./example) directory has one runnable script per option; each is a\nstandalone prompt, run it with `node example/<file>.js`.\n\n| Example | Covers |\n| --- | --- |\n| [`items.js`](./example/items.js) | item properties: bare strings, `name`, `value`, `short`, `open`, multiline names |\n| [`tree.js`](./example/tree.js) | `tree` as an async function, lazy `children`, a `children` function replacing its own item, and one that fails |\n| [`validate.js`](./example/validate.js) | `validate`, and `isValid` to opt an item out of it |\n| [`onlyShowValid.js`](./example/onlyShowValid.js) | `onlyShowValid`: hide the items `validate` rejects |\n| [`hideChildrenOfValid.js`](./example/hideChildrenOfValid.js) | `hideChildrenOfValid`: make valid items leaves |\n| [`transformer.js`](./example/transformer.js) | `transformer`: display nameless values differently |\n| [`filter.js`](./example/filter.js) | `filter`, single and multiple selection, synchronous and asynchronous |\n| [`multiple.js`](./example/multiple.js) | `multiple` on the prompt and on individual items |\n| [`pageSize.js`](./example/pageSize.js) | `pageSize` counting rows rather than items |\n| [`loop.js`](./example/loop.js) | `loop: false` versus the default |\n| [`simple.js`](./example/simple.js) | a whole menu putting several options together |\n\n### Development\n```\nnpm test    # node:test, no extra dependency\nnpm run lint\n```\n","readmeFilename":"README.md","_rev":"1-3e844653699201d3bf5da5a43d484134"}