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

@cartridge-engine/select

v3.0.0

Published

Text input with focus management

Downloads

61

Readme

SelectInput

Vertical list selector with keyboard navigation and scrolling.

Props

| Prop | Type | Required | Default | Description | |------|------|----------|---------|-------------| | items | Item<T>[] | yes | [] | { label: string, value: T } | | onSelect | (item: Item<T>) => void | yes | — | Called on Enter. | | focusId | string | yes | — | Focus target. | | itemComponent | ComponentType<I & { isSelected: boolean }> | no | default label | Custom item renderer. Receives the item plus isSelected. | | indicatorComponent | ComponentType<{ isSelected: boolean }> | no | ❯ (blue) | Left-of-item indicator. Receives isSelected. | | limit | number | no | 10 | Max visible items before scrolling. |

Keyboard (scoped to focusId)

| Key | Action | |-----|--------| | ↑ / k | Move up | | ↓ / j | Move down | | Enter | Select highlighted item | | 1–9 | Jump to nth visible item |

Best Practice

<SelectInput
  focusId="menu"
  items={[
    { label: 'Start Game', value: 'start' },
    { label: 'Settings', value: 'settings' },
    { label: 'Quit', value: 'quit' },
  ]}
  onSelect={(item) => handleSelect(item.value)}
/>

SelectRow

Horizontal item selector. Same API as SelectInput but with left/right navigation and indicator below each item.

Props

Same as SelectInput except:

  • Default indicatorComponent is ● (rendered below)
  • indicatorComponent receives React.ComponentType<{ isSelected: boolean }>

Keyboard (scoped to focusId)

| Key | Action | |-----|--------| | ← / h | Move left | | → / l | Move right | | Enter | Select highlighted item | | 1–9 | Jump to nth visible item |

Best Practice

<SelectRow
  focusId="tabs"
  items={[
    { label: 'Tab A', value: 'a' },
    { label: 'Tab B', value: 'b' },
  ]}
  onSelect={(item) => setActive(item.value)}
/>

MultiSelectInput

Multi-select list with checkboxes and batch operations.

Props

| Prop | Type | Required | Default | Description | |------|------|----------|---------|-------------| | items | Item<T>[] | yes | [] | { label: string, value: T } | | selected | T[] | no | — | Controlled: selected values. | | defaultSelected | T[] | no | [] | Uncontrolled initial selection. | | onChange | (selected: T[]) => void | no | — | Called on any selection change. | | onSubmit | (selected: T[]) => void | no | — | Called on Enter. | | onSelect | (item: Item<T>) => void | no | — | Called when an item is toggled ON. | | onUnselect | (item: Item<T>) => void | no | — | Called when an item is toggled OFF. | | onHighlight | (item: Item<T>) => void | no | — | Called when the highlight cursor moves to a different item. | | focusId | string | yes | — | Focus target. | | limit | number | no | 10 | Max visible items. | | initialIndex | number | no | 0 | Index of the initially highlighted item (0-based). | | checkboxComponent | ComponentType<{ isSelected: boolean }> | no | ◉/○ | Custom checkbox. Receives isSelected. | | indicatorComponent | ComponentType<{ isHighlighted: boolean }> | no | ❯ | Left-of-item indicator. Receives isHighlighted. | | itemComponent | ComponentType<I & { isHighlighted: boolean }> | no | default label | Custom item renderer. Receives item plus isHighlighted. |

Keyboard (scoped to focusId)

| Key | Action | |-----|--------| | ↑ / k | Move up | | ↓ / j | Move down | | Space | Toggle item | | Enter | Submit | | a | Select all | | q | Deselect all | | 1–9 | Toggle nth visible item |

Best Practice

// Uncontrolled
<MultiSelectInput
  focusId="choices"
  items={options}
  defaultSelected={['a']}
  onSubmit={(selected) => console.log(selected)}
/>

// Controlled
<MultiSelectInput
  focusId="choices"
  items={options}
  selected={selected}
  onChange={setSelected}
/>