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

@danielivanov/mention

v0.2.0

Published

Headless React mention suggestions for textareas and editor integrations.

Readme

@danielivanov/mention

Headless React mention suggestions for native textareas and editor integrations. Multiple triggers, async search, keyboard navigation, caret positioning, and optional styles. Requires React 19.

bun add @danielivanov/mention@^0.2.0
import { Mention } from "@danielivanov/mention";
import "@danielivanov/mention/styles.css";

type Person = { id: string; name: string };
const people: Person[] = [{ id: "alice", name: "Alice" }];

export function Composer() {
  return (
    <Mention.Root items={people} getKey={p => p.id} getLabel={p => p.name}>
      <Mention.Input aria-label="Message" name="message" />
      <Mention.Popover aria-label="People">
        <Mention.Loading>Searching…</Mention.Loading>
        <Mention.List<Person>>
          {person => <Mention.Item value={person}>{person.name}</Mention.Item>}
        </Mention.List>
        <Mention.Empty>No people found</Mention.Empty>
      </Mention.Popover>
    </Mention.Root>
  );
}

Use standard value, onChange, onBlur, onKeyDown, and ref props on Mention.Input. Consumer key handlers run first and can prevent Mention's handling. onSelect on Root is an optional notification after a successful insertion. The standalone useMention() hook registers a textarea when its getInputProps() are spread.

For multiple triggers, supply triggers={{ "@": peopleConfig, "#": channelConfig }} to Root or use useMentionMulti(). Each channel has items, getKey, getLabel, and optional getInsertText. Async fetchers receive (query, signal); requests debounce for 150 ms by default. Obsolete results cannot be selected.

Rich editors register an EditorAdapter<T> with setEditor(). The adapter reads one text region, measures the caret, and replaces a range using the editor's own transaction. The editor owns chips, formatting, clipboard data, and undo. See the executable ProseMirror and Lexical examples, exercised by browser tests. Other editor integrations need their own adapters and verification.

Textareas retain their native textbox semantics. Rich editors supply their own textbox role and multiline state; Mention adds listbox and active-option relationships. Automated checks do not prove assistive-technology compatibility. See the accessibility documentation for the testing boundary.

Run bun run build, bun run test, and bun run test:e2e from the repository root. The size budget is 14 kB gzipped, including Floating UI. The editor example is outside the published runtime.

Name matching

By default, spaces end a query and arrays use case-insensitive label substring matching. Set allowSpaces per channel for full names, and supply a pure filter(item, query) for local accent folding or application-specific rules. Async fetcher results bypass this filter. Tabs, line breaks, and editor atoms always end a query. See international input.