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

event-banner

v1.0.5

Published

A customizable web component for displaying event banners on your website

Readme

Event Banner Component

A customizable web component for displaying event banners on your website. Easy to integrate and fully responsive.

event-banner

Demo

Installation

# Using npm
npm install event-banner

# Using yarn
yarn add event-banner

# Using pnpm
pnpm add event-banner

Usage

Using ES modules

// Import the component
import 'event-banner';

// Use in your HTML
<event-banner>
  <img slot="icon" src="icon.svg" alt="Icon">
  <a slot="link">Your message here</a>
</event-banner>

Using CDN

<script type="module" src="https://cdn.jsdelivr.net/npm/event-banner@latest/src/event-banner.js"></script>

Attributes

| Attribute | Description | Default | Example | | ---------- | ---------------------------------------- | --------- | ------------------- | | top | Position from top (for fixed position) | "20%" | "30%", "20px", "2rem" | | width | Banner width | "auto" | "100%", "500px" | | fixed | Fixed positioning | true | "false" | | duration | Auto-close duration in milliseconds. It will not automatically close if set 0 | 15000 | "0", "2000" |

Slots

The component provides three slots for content customization:

  • icon: For the banner icon (usually an image)
  • link: For the main content/message
  • close: For the close button (has a default implementation)

Styling

Using :host

<event-banner style="background: sandybrown;">
  <img src="./banner.svg" alt="Info icon" slot="icon" />
  <a slot="link">
    lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam...
  </a>
</event-banner>

Using ::part

The component exposes several parts that can be styled from the outside:

/* Style the icon container */
#custom-parts-banner::part(icon-container) {
  background: sandybrown;
  padding: 4px;
  border-radius: 4px;
}

/* Style the link container */

#custom-parts-banner::part(link-container) {
  border: 2px solid salmon;
}

/* Style the close button container */
#custom-parts-banner::part(close-container) {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.3s;
}
<event-banner id="custom-parts-banner">
  <img src="./banner.svg" alt="Info icon" slot="icon" />
  <a slot="link">
    lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam...
  </a>
</event-banner>

Examples

Default Banner (Center Position)

<event-banner>
  <img src="./banner.svg" alt="Info icon" slot="icon" />
  <a slot="link">Your message here</a>
</event-banner>

Custom top (30% from top)

<event-banner top="30">
  <img src="./banner.svg" alt="Info icon" slot="icon" />
  <a slot="link">Your message here</a>
</event-banner>

Static Banner (Full Width)

<event-banner fixed="false" width="100%">
  <img src="./banner.svg" alt="Info icon" slot="icon" />
  <a slot="link">
    lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam...
  </a>
</event-banner>

Custom Close Button

<event-banner>
  <img src="./banner.svg" alt="Info icon" slot="icon" />
  <a slot="link">
    lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam...
  </a>
  <button slot="close" class="close-button">
    <img src="./btn_close.svg" alt="close" style="width: 30px;height: 30px;" />
  </button>
</event-banner>

Custom Duration

<!-- Auto-close after 2 seconds -->
<event-banner duration="2000">
  <img src="./banner.svg" alt="Info icon" slot="icon" />
  <a slot="link">This banner will auto-close after 2 seconds</a>
</event-banner>

<!-- Disable auto-close -->
<event-banner duration="0">
  <img src="./banner.svg" alt="Info icon" slot="icon" />
  <a slot="link">This banner will not auto-close</a>
</event-banner>

Default Styles

The banner comes with a default dark theme:

  • Dark background
  • White text
  • Responsive layout
  • Smooth close animation
  • Flexible width
  • Optional fixed positioning