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

html-compo

v3.1.0

Published

A simple reusable html elemental components coding framework

Readme

HTML Components Create and Reuse

A lightweight JavaScript library for creating reusable HTML components without any build tools or complex setup.

🚀 Quick Start

<script src="https://cdn.jsdelivr.net/npm/html-compo@latest/src/main.js"></script>

<user-card>John Doe</user-card>
<user-card>Jane Smith</user-card>

<html-components>
  <user-card>
    <div class="card">
      <h3>@{self.data}</h3>
      <p>Welcome, @{self.data}!</p>
    </div>
  </user-card>
</html-components>

📚 Documentation

🌐 Online Resources

📦 Installation

CDN (Recommended)

<script src="https://cdn.jsdelivr.net/npm/html-compo@latest/src/main.js"></script>

NPM

npm install html-compo

Then import in your project:

import 'html-compo';

✨ Key Features

  • 🎯 Zero Dependencies - Pure JavaScript, no framework required
  • 📝 Simple Syntax - Use familiar HTML with @{variable} templating
  • 🔧 Attribute Binding - Pass data through HTML attributes
  • 🎨 Shadow DOM Support - Encapsulated styling with fragment="true"
  • 🔗 Component References - Access and manipulate components via ref attribute
  • 📱 Framework Agnostic - Works with any existing HTML/JavaScript project
  • 🚀 TypeScript Ready - Full type definitions included

🏃‍♂️ Basic Usage

1. Define Components

<html-components>
  <greeting-card>
    <div class="greeting">
      <h2>Hello, @{self.data}!</h2>
      <p>This is a reusable component.</p>
    </div>
  </greeting-card>
</html-components>

2. Use Components

<greeting-card>World</greeting-card>
<greeting-card>HTML-COMPO.js</greeting-card>

3. With Attributes

<user-profile name="John" role="Admin" email="[email protected]"></user-profile>

<html-components>
  <user-profile compo-attrs="name,role,email">
    <div class="profile">
      <h3>@{name}</h3>
      <p>Role: @{role}</p>
      <p>Email: @{email}</p>
    </div>
  </user-profile>
</html-components>

🎮 Interactive Examples

Check out our interactive examples page featuring:

  • 📊 Dashboard Components - Real-time stats and user management
  • 🛒 Shopping Cart - Add/remove items with dynamic totals
  • 💬 Chat Interface - Message components with different types
  • 📈 Data Visualization - Progress bars and charts
  • 🎮 Mini Games - Interactive number guessing game
  • 🎨 Theme System - Dynamic theme switching

🔗 API Reference

Global API

// Get component by reference
const component = htmlCompo.getComponent('my-ref');

// Manipulate component content
component.html('New content');
component.attr('class', 'new-class');

Template Variables

  • @{self.data} - Content inside component tags
  • @{self.componentName} - Component tag name
  • @{attributeName} - Values from component attributes

Component Definition

<html-components>
  <my-component compo-attrs="prop1,prop2=defaultValue" fragment="true">
    <!-- Component template with @{variables} -->
  </my-component>
</html-components>

🎯 Advanced Features

Shadow DOM Encapsulation

<html-components>
  <styled-component fragment="true">
    <style>
      .component-style { color: blue; }
    </style>
    <div class="component-style">@{self.data}</div>
  </styled-component>
</html-components>

Component References

<interactive-counter ref="counter1" value="0"></interactive-counter>

<script>
const counter = htmlCompo.getComponent('counter1');
counter.attr('value', '10');
</script>

💾 TypeScript Support

HTML-COMPO.js includes full TypeScript support:

// Type-safe component access
const component = window.htmlCompo.getComponent('my-ref');
if (component) {
  const content: string = component.html();
  component.attr('class', 'new-class');
}

See TypeScript documentation for complete setup instructions.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

MIT License - see LICENSE file for details.

👨‍💻 Author

Sarthak Pokharel