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

@carissa-io/components-tag-input

v0.1.1

Published

Carissa UI: tag input (tags inside the field, delimiters, paste, limits) as a React component with SCSS variables

Readme

@carissa-io/components-tag-input

Tag input: TagInput. The tags and the text field share one input box: type, press a delimiter, get a tag. Built on the look of @carissa-io/components-input (box, label, error line) and the chips of @carissa-io/components-tag. A React component, SCSS-themed.

npm i @carissa-io/components-tag-input

Use

import { TagInput } from '@carissa-io/components-tag-input'

<TagInput
    label={t('recipients')}
    placeholder={t('add_email')}
    remove_label={(tag) => t('remove_tag', { tag })}
    max={10}
    validate={(tag) => !tag.includes('@') && 'not_an_email'}
    messages={{ duplicate: t('already_added'), max: t('too_many'), not_an_email: t('bad_email') }}
    on_change={(tags) => setRecipients(tags)}
/>

| Prop | | |---|---| | value, on_change(values) | controlled tags (array of strings); without value the component keeps its own state | | default_value | the initial tags when uncontrolled (default []) | | on_add(tag), on_remove(tag, index) | fire for each tag added or removed | | delimiters | keys that commit the text (default ['Enter', ',']): KeyboardEvent.key names or any single character (;, ) | | allow_duplicates | default false | | max | maximum number of tags | | validate(tag) | falsy when fine, or an error code (a string); any other truthy value means invalid | | messages, on_error(code) | text for the codes (the bare code is shown without an entry); on_error is told about each refusal | | error | an error the parent decides on; wins over the internal one | | remove_label | aria-label of the remove buttons: a string, or (tag) => string (default the code remove) | | label, placeholder, name, id, disabled, required | the label, the placeholder (only shown while there are no tags), ... |

name renders one hidden input per tag (same name), so a form submits the list. className is appended to the wrapper next to c-input c-tag-input; unknown props go to the text <input>.

Behaviour

  • A delimiter key adds the trimmed text; empty pieces are skipped. Enter on an empty field is left to the form. A refused tag (error code duplicate, max or invalid, or the code your validate returns) stays in the field so it can be fixed and the code is cleared as soon as the text changes.
  • A paste that contains a delimiter is split on all of them (Enter splits on line breaks) and every piece becomes a tag; a paste without one goes into the field as plain text.
  • Backspace on an empty field removes the last tag. ArrowLeft on an empty field focuses the last tag; Left / Right move between tags and Right on the last one returns to the field. Backspace or Delete on a focused tag removes it (the focus goes to the next tag, or the field); clicking its button removes it too (the focus goes to the field).
  • Text left in the field on blur is not added: commit it with a delimiter.

Style

@use '@carissa-io/components-tag-input/scss' with (
    $c-tag-input-gap: 0.5rem,
    $c-tag-primary-background: #e7f0ff,
    $c-input-radius: 0
);

The box is the Input's ($c-input-*) and the chips are the Tag's ($c-tag-*); the module forwards both. Classes: c-tag-input, c-tag-input__field, c-tag-input__tag, c-tag-input__control next to the Input's (c-input__box, c-input__label, c-input__error...) and the Tag's (c-tag...). Every variable is !default (see scss/_variables.scss).

| Variable | Default | |---|---| | $c-tag-input-gap | 0.375rem (between tags and the text field, and between rows) | | $c-tag-input-control-min-width | 6rem (the text field wraps to its own row below this width) |