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

@botandrose/input-tag

v0.4.2

Published

A declarative, zero-dependency, framework-agnostic custom element for tag input with autocomplete

Readme

@botandrose/input-tag

A declarative, framework-agnostic custom element for tag input with optional autocomplete functionality.

Built with appreciation on the excellent foundation of Taggle.js by Sean Coker.

Installation

npm install @botandrose/input-tag

Usage

Import the custom element:

import "@botandrose/input-tag"

Then use it in your HTML:

<input-tag name="tags" multiple>
  <tag-option value="javascript">JavaScript</tag-option>
  <tag-option value="typescript">TypeScript</tag-option>
</input-tag>

<datalist id="suggestions">
  <option value="react">React</option>
  <option value="vue">Vue</option>
  <option value="angular">Angular</option>
</datalist>

<input-tag name="frameworks" list="suggestions" multiple></input-tag>

Features

  • Form-associated custom element with full form integration
  • Autocomplete support via datalist or custom options
  • Multiple/single value modes
  • Real-time validation
  • Accessible keyboard navigation
  • Shadow DOM encapsulation
  • Framework-agnostic

API

Attributes

  • name: Form field name
  • multiple: Allow multiple tags (default: single tag mode)
  • required: Make field required
  • list: ID of datalist for autocomplete suggestions

Properties

  • value: Get/set tag values - returns array when multiple, string when single mode
  • tags: Get current tag values as array (read-only)
  • options: Get available autocomplete options from datalist
  • form: Reference to associated form element
  • name: Get the name attribute value

Events

  • change: Fired when tag values change
  • update: Fired when individual tags are added/removed with detail {tag, isNew}

Methods

Tag Management

  • add(tag | tags[]): Add single tag or array of tags
  • remove(tag): Remove specific tag by value
  • removeAll(): Clear all tags
  • has(tag): Check if tag exists
  • addAt(tag, index): Add tag at specific position

Form Integration

  • reset(): Clear all tags and input field
  • checkValidity(): Check if field passes validation
  • reportValidity(): Check validity and show validation UI

Interaction

  • focus(): Focus the input field
  • disable(): Disable the input
  • enable(): Enable the input

JavaScript API Example

// Multiple mode
const multipleTag = document.querySelector('input-tag[multiple]')

// Add tags
multipleTag.add('react')
multipleTag.add(['vue', 'angular'])

// Get current tags
console.log(multipleTag.value) // ['react', 'vue', 'angular'] - returns array
console.log(multipleTag.tags)  // ['react', 'vue', 'angular'] - also array

// Set all tags at once
multipleTag.value = ['new', 'tags'] // accepts array

// Single mode
const singleTag = document.querySelector('input-tag:not([multiple])')

// Set single tag
singleTag.value = 'selected-tag' // accepts string

// Get current tag
console.log(singleTag.value) // 'selected-tag' - returns string
console.log(singleTag.tags)  // ['selected-tag'] - always array

// Backward compatibility: arrays still work in single mode
singleTag.value = ['another-tag'] // accepts array, uses first item
console.log(singleTag.value) // 'another-tag' - still returns string

// Form validation
if (!singleTag.checkValidity()) {
  singleTag.reportValidity()
}

Testing

npm test
npm run test:all

License

MIT