Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@zemke/tagbox
Advanced tools
Zero dependency Web Component input field (no contenteditable) supporting tags. Backed by standard HTML elements.
Zero dependency Web Component single-line input field (no contenteditable) with ability to enter tags.
input
and select
elementsnpm i @zemke/tagbox
<script src="js.js"></script>
<zemke-tagbox>
<input type="text" name="message">
<select multiple name="tags">
<option value="1">James</option>
<option value="2">Robert</option>
<option value="3">John</option>
<option value="4">Michael</option>
<option value="5">David</option>
<option value="6">William</option>
</select>
</zemke-tagbox>
search - start (default), infix, levenshtein
How to filter the suggestions.
Match from start, anywhere (infix) or fuzzy matching using Levenshtein algorithm.
When using Levenshtein you can provide the match boundary followed by a comma.
I.e. search="levenshtein,60"
filter by string similarity at least 60% (default is 80%).
ci
Add this value to make the search case-insensitive.
nothing
The message to show when no match has been found. Default is "Nothing found."
length
The number of suggestions to show. Default is 4.
Here's an example of all attributes in use:
<zemke-tagbox length="6"
ci
nothing="No such entry."
search="infix">
...
There are three parts of this Web Component that can be styled using CSS:
Use CSS's
::part
pseudo-element i.e. zemke-tagbox::part(tag)
.
The demo includes a individually styled version of the Web Component.
The input field that the user types in is in a Shadow DOM.
Therefore you can't add attributes it like you're used to.
At the end of the day zemke-tagbox
is not an input field.
You could do so if you're willing to do it with JavaScript like this:
document.querySelector('zemke-tagbox')
.chatInputEl.setAttribute('placeholder', "Enter your message here")
If you have CSS rules for input fields they won't apply to this element.
You'll have to hand-write CSS to copy your rules over to zemke-tagbox
element.
If you're using Bootstrap with SCSS this could be as easy as:
zemke-tagbox::part(input) {
@extend .form-control;
}
Bonus tip if you're using it within a Bootstrap .input-group
I found this to work:
.input-group zemke-tagbox::part(input) {
height: inherit;
box-sizing: border-box;
}
.input-group zemke-tagbox {
flex: 1 1 0%;
box-sizing: border-box;
position: relative;
}
If
marginLeft
, borderLeftWidth
, borderRightWidth
, paddingLeft
, paddingRight
or width
change without the input element itself changing its dimensions, the tags might be off.
FAQs
Zero dependency Web Component input field (no contenteditable) supporting tags. Backed by standard HTML elements.
We found that @zemke/tagbox demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.