
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.