npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tooee/choose

v0.3.1

Published

Terminal selection with fuzzy filtering

Readme

@tooee/choose

Terminal selection with fuzzy filtering. Choose and ChooseOverlay are compatibility assemblies over the same reusable primitive:

  • useChoose() owns normalized source loading, filtering, active/multi-selection state, commands, command context, and a stable controller.
  • ChooseFilter, ChooseList, and ChooseHighlightedText are reusable controlled views.
  • ChoosePanel supplies picker chrome and hint/status/footer slots.
  • Choose retains the fullscreen app, theme picker, actions, and launch behavior.
  • ChooseOverlay retains single-select menu semantics and adds optional multi-select, controller, command, row, and chrome extensions.

Source and controller

ChooseSource accepts an item array, a ChooseContentProvider, or a sync/async loader. Replaced sources ignore stale async results. Successful replacements reset active and selected state; direct array changes are reflected just like loaders.

Use controllerRef on an assembly, or the controller returned by useChoose, to set/clear the filter, move or set the active row, toggle selection, submit/cancel, change mode, or reload the current source.

Promise-based dialog

useChooseDialog<T>() opens ChooseOverlay as a modal dialog on the host's overlay stack and resolves the typed selection:

const choose = useChooseDialog<Model>();

const model = await choose.open({
  items: models, // readonly T[] or a sync/async loader
  toItem: (m) => ({ text: m.label }), // optional when T is a ChooseItem
  prompt: "Pick a model",
});
// T on select, T[] with { multi: true }, null on cancel/replacement/unmount

Generics are retained without casts: single-select resolves T | null, multi-select resolves T[] | null (Choose selection semantics: toggled items, falling back to the active item). Each open() owns one overlay record (unique id per call) and one owned modal command surface; the promise settles exactly once. The host must render overlay content (AppLayout does; custom hosts render useCurrentOverlay()).

Command surfaces

Built-in interaction uses useCommand, so a nested modal command surface suspends the chooser automatically. A filter also blurs while another modal surface owns input. Mouse events bypass command-surface arbitration; pass suspended to a custom ChooseList host when covered rows can remain visible.

ChooseOverlay expects its host to provide an owned modal command surface, either through Tooee's overlay manager (ownCommands: true, role: "modal") or an explicit CommandSurfaceProvider. It does not create another surface internally.

Reserved built-in keys:

  • Both modes: Up, Down, Ctrl+P, Ctrl+N, Enter.
  • Insert mode: Escape and, for multi-select, Tab/Shift+Tab.
  • Cursor mode: j, k, i, a, q, Escape and, for multi-select, Tab/Shift+Tab.

Consumer commands should prefer control chords, leader sequences, or other non-reserved keys. Built-in groups can be disabled through useChoose({ disable: [...] }) when a custom host deliberately owns one.

Part of the Tooee monorepo.