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

tosijs-ui

v1.5.24

Published

simple robust web-components for use with tosijs or anything else

Readme

tosijs-ui

ui.tosijs.net live demo | tosijs | discord | github | npm

tosijs is on NPM tosijs is about 10kB gzipped tosijs on jsdelivr

Copyright ©2023-2025 Tonio Loewald

the tosijs-ui library

A set of web-components created with tosijs, designed to augment what the browser gives you for free rather than replace it.

It works beautifully with other web-component libraries, such as shoelace.style.

Migrating to v1.3.0

v1.3.0 completes the rename from xinjs-ui to tosijs-ui. All custom element tags now use the tosi- prefix and all exports use Tosi*/tosi* names.

Breaking changes

  • Custom element tags have changed from <xin-*> to <tosi-*>. For example: <xin-select> is now <tosi-select>, <xin-icon> is now <tosi-icon>, <xin-example> is now <tosi-example>, etc.
  • CSS selectors targeting old tag names (e.g. xin-select { ... }) must be updated.
  • CSS custom properties in component styleSpec objects retain --xin-* fallbacks for backward compatibility, but new code should use --tosi-*.

Deprecated exports still work

The old xin* JavaScript exports (xinSelect, xinTabs, xinTable, etc.) remain available and will continue to work. Most log a runtime deprecation warning; a few are silent aliases marked with JSDoc @deprecated. They will be removed in a future major version.

Migration checklist

  1. Search your HTML for <xin- and replace with <tosi-
  2. Search your CSS for xin- selectors and update to tosi-
  3. Search your JS/TS for xinSelect, xinTabs, etc. and switch to tosiSelect, tosiTabs, etc.
  4. Search for --xin- CSS variable overrides and switch to --tosi-

Quick Start

Using npm and a bundler

Add tosijs-ui to your project, e.g.

npm add tosijs-ui

Then import the component elementCreator and create elements. A tosijs elementCreator is syntax sugar around document.createElement().

import { tosiTable } from 'tosijs-ui'

document.body.append(tosiTable())

Using the iife via cdn

The tosijs-ui iife build bundles tosijs, tosijs-ui, and marked into a single minified javascript source file. You can access xinjs and xinjsui as globals which contain all the things exported by tosijs and tosijs-ui.

<script src="https://ui.tosijs.net/iife.js"></script>
<button id="menu">Menu <tosi-icon icon="chevronDown"></tosi-icon></button>
<script>
  const { elements } = xinjs
  const { popMenu, icons } = xinjsui
  const { button } = elements

  const showMenu = (target) => {
    popMenu({
      target,
      menuItems: [
        {
          caption: 'Say hello',
          action() {
            alert('hello')
          }
        },
        null,
        {
          caption: 'Version',
          action() {
            alert(`tosijs ${xinjs.version}\ntosijs-ui ${xinjsui.version}`)
          }
        }
      ]
    })
  }

  document.body.append(
    button(
      {
        onClick(event) {
          showMenu(event.target)
        }
      },
      'Menu',
      icons.chevronDown()
    )
  )
</script>

Click here to see a simple iife demo

custom-elements

The simplest way to use these elements is to simply import the element and then either use HTML or the ElementCreator function exported.

E.g. to use the markdown viewer:

import { tosiMd } from 'tosijs-ui'
document.body.append(tosiMd('# hello world\nthis is a test'))
import { tosiMd } from 'tosijs-ui'

preview.append(
  tosiMd(`
## hello world
here is some markdown
`)
)

Assuming you import the module somewhere, the HTML will work as well.

<tosi-md>
## hello world
here is some markdown
</tosi-md>

The big difference with using the tosiMd() function is that the tosijs Component class will automatically pick a new tag if the expected tag is taken (e.g. by a previously defined custom-element from another library). tosiMd() will create an element of the correct type.

The other thing is that tosijs ElementCreator functions are convenient and composable, allowing you to build DOM elements with less code than pretty much any other option, including JSX, TSX, or HTML.

Philosophy

In general, tosijs strives to work with the browser rather than trying to replace it.

In a similar vein, tosijs-ui comprises a collection of web-components with the goal of augmenting what already works well, and the components are intended to be as similar as possible to things that you already use, such as <input> or <select> elements. E.g. where appropriate, the value of an element is its malleable state, and when this changes, the element emits a change event.

Similarly, the tosijs base Component class and the components in this collection strive to be as similar in operation as possible to DOM elements as makes sense. E.g. binary attributes work as expected. Adding the hidden attribute makes them disappear. If a component subclass has a value property then it will be rendered if the value changes (similarly it will be rendered if an initialized attribute is changed). Intrinsic properties of components will default to null rather than undefined.

Similarly, because web-components are highly interoperable, there's no reason to reinvent wheels. In particular, this library won't try to replace existing, excellent libraries such as shoelace.style or wrap perfectly functional HTML elements, like the venerable <input> or <form> elements that are already capable and accessible.

The goal here is to provide useful components and other utilities that add to what's built into HTML5 and CSS3 and to make custom-elements work as much as possible like drop-in replacements for an <input> or <textarea> (while mitigating the historical pathologies of things like <select> and <input type="radio">). E.g. the <tosi-select> does not suffer from a race-condition between having its value set and being given an <option> with the intended value and you can differentiate between the user picking a value (action) and the value changing (change).

Credits

tosijs-ui is being developed using bun. bun is crazy fast (based on Webkit's JS engine, vs. V8), does a lot of stuff natively, and runs TypeScript (with import and require) directly.

Logo animations by @anicoremotion.