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

@requence/tokenized-search

v1.2.0

Published

Tokenized search input with TipTap-powered rich text editing, dropdown suggestions, and structured query parsing for React

Downloads

68

Readme

@requence/tokenized-search

Tokenized search input with TipTap-powered rich text editing, dropdown suggestions, and structured query parsing for React.

Documentation · GitHub

Installation

npm install @requence/tokenized-search

Prerequisites

This package uses Tailwind CSS utility classes internally (via tailwind-merge). Your project must have Tailwind CSS configured for the component to render correctly.

Add the @source directive to your CSS entry point so Tailwind scans the package for class names:

@import "tailwindcss";
@source "../node_modules/@requence/tokenized-search";

Quick Start

import { TokenizedSearch } from '@requence/tokenized-search'

function MySearch() {
  return (
    <TokenizedSearch
      tokens={[
        {
          key: 'status',
          label: 'Status',
          exclusive: true,
          options: [
            { value: 'active', label: 'Active' },
            { value: 'inactive', label: 'Inactive' },
          ],
        },
        {
          key: 'source',
          label: 'Source',
          options: async (query, signal) => {
            const res = await fetch(`/api/sources?q=${query}`, { signal })
            return res.json()
          },
        },
      ]}
      onSearch={(segments, rawText) => {
        console.log('Search:', segments, rawText)
      }}
    />
  )
}

Exports

All exports are available from the package root:

| Export | Type | Description | | --- | --- | --- | | TokenizedSearch | Component | Rich text search input with token highlighting and dropdowns | | slots | Object | All slot sub-components as a plain object (for advanced usage) | | parseTokenizedSearch | Function | Parse a raw query string into structured segments | | getOptionDisplayText | Function | Resolve display text for a token option (label ?? value) | | toTechnicalQuery | Function | Convert display-form query (labels) to technical form (keys/values) | | toDisplayQuery | Function | Convert technical-form query (keys/values) to display form (labels) |

Types

All types are exported as named type exports:

TokenizedSearchProps, TokenizedSearchHandle, TokenizedSearchTokenDefinition, TokenOption, TokenizedSearchSegment, TokenSegment, TextSegment, DropdownContext, ValueDropdownContext, SuggestDropdownContext, SlotProps

Customization with Slots

TokenizedSearch is a compound component. Pass slot sub-components as children to override default classes and content. Slots are config-only — they render nothing themselves; the root component reads their props.

Slot hierarchy

<TokenizedSearch>
  <TokenizedSearch.Input className="…">          <!-- input wrapper -->
    <TokenizedSearch.Placeholder className="…">…</TokenizedSearch.Placeholder>
    <TokenizedSearch.TokenKey className="…" />
    <TokenizedSearch.TokenValue className="…" />
    <TokenizedSearch.TokenNegation className="…" />
  </TokenizedSearch.Input>

  <TokenizedSearch.ClearButton className="…">…</TokenizedSearch.ClearButton>
  <TokenizedSearch.SubmitButton className="…">…</TokenizedSearch.SubmitButton>

  <TokenizedSearch.Dropdown className="…">       <!-- dropdown wrapper -->
    <TokenizedSearch.DropdownOption className="…" />
    <TokenizedSearch.DropdownNotOption className="…" />
    <TokenizedSearch.DropdownSeparator className="…" />
    <TokenizedSearch.HighlightMatch className="…" />
    <TokenizedSearch.FilterByLabel className="…">…</TokenizedSearch.FilterByLabel>
    <TokenizedSearch.SuggestionIcon className="…" />
    <TokenizedSearch.EmptyMessage className="…">…</TokenizedSearch.EmptyMessage>
    <TokenizedSearch.Loader className="…">…</TokenizedSearch.Loader>
  </TokenizedSearch.Dropdown>
</TokenizedSearch>

Example

<TokenizedSearch tokens={tokens} onSearch={handleSearch}>
  <TokenizedSearch.Input className="rounded-lg border-2 border-blue-300">
    <TokenizedSearch.Placeholder className="text-gray-400">
      Search by status, source…
    </TokenizedSearch.Placeholder>
    <TokenizedSearch.TokenKey className="text-blue-600 font-semibold" />
    <TokenizedSearch.TokenValue className="text-emerald-600" />
  </TokenizedSearch.Input>

  <TokenizedSearch.ClearButton className="text-gray-400 hover:text-gray-600">
    ✕
  </TokenizedSearch.ClearButton>

  <TokenizedSearch.Dropdown className="shadow-xl rounded-lg">
    <TokenizedSearch.DropdownOption className="hover:bg-blue-50" />
    <TokenizedSearch.EmptyMessage className="text-gray-400 italic">
      No results found
    </TokenizedSearch.EmptyMessage>
  </TokenizedSearch.Dropdown>
</TokenizedSearch>

License

MIT