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

card-esm

v1.0.0

Published

Lightweight TypeScript card components with ESM support

Readme

card-esm

Lightweight TypeScript card components with ESM support.

Features

  • 4 core card component types
  • 5 visual style variants for each component
  • Full TypeScript type definitions
  • Framework-agnostic design
  • Compatible with Vue3 and Angular15+
  • Lightweight implementation with no complex rendering logic

Installation

npm install card-esm

Components

1. BasicCard

Simple card component for displaying content.

import { createBasicCard } from 'card-esm';

const card = createBasicCard({
  variant: 'default',
  children: 'Hello, World!'
});

card.mount(document.getElementById('app'));

2. ImageCard

Card component with image support.

import { createImageCard } from 'card-esm';

const card = createImageCard({
  variant: 'default',
  imageSrc: 'path/to/image.jpg',
  imageAlt: 'Card image',
  title: 'Card Title',
  description: 'Card description'
});

card.mount(document.getElementById('app'));

3. ListCard

Card component with list items.

import { createListCard } from 'card-esm';

const card = createListCard({
  variant: 'default',
  title: 'My List',
  items: [
    { id: 1, content: 'Item 1', icon: '📌' },
    { id: 2, content: 'Item 2', icon: '📌' },
    { id: 3, content: 'Item 3', icon: '📌' }
  ]
});

card.mount(document.getElementById('app'));

4. HoverCard

Card component with hover effects.

import { createHoverCard } from 'card-esm';

const card = createHoverCard({
  variant: 'default',
  children: 'Hover over me!',
  hoverContent: 'Hover content',
  hoverDelay: 200
});

card.mount(document.getElementById('app'));

Variants

Each component supports 5 visual style variants:

  • default - Standard styling with shadow
  • simple - Minimal styling without shadow
  • border - Border-focused styling
  • shadow - Enhanced shadow effect
  • highlight - Highlighted styling with accent color

Usage in Vue3

<script setup>
import { onMounted } from 'vue';
import { createBasicCard } from 'card-esm';

onMounted(() => {
  const card = createBasicCard({
    variant: 'default',
    children: 'Vue3 Card'
  });
  card.mount(document.getElementById('card-container'));
});
</script>

<template>
  <div id="card-container"></div>
</template>

Usage in Angular15+

import { Component, AfterViewInit, ElementRef } from '@angular/core';
import { createBasicCard } from 'card-esm';

@Component({
  selector: 'app-card',
  template: '<div #cardContainer></div>'
})
export class CardComponent implements AfterViewInit {
  @ViewChild('cardContainer', { static: true }) cardContainer!: ElementRef;

  ngAfterViewInit() {
    const card = createBasicCard({
      variant: 'default',
      children: 'Angular Card'
    });
    card.mount(this.cardContainer.nativeElement);
  }
}

API Reference

Types

type CardVariant = 'default' | 'simple' | 'border' | 'shadow' | 'highlight';

interface BaseCardProps {
  variant?: CardVariant;
  className?: string;
  style?: Record<string, string | number>;
  children?: React.ReactNode | string;
}

interface ImageCardProps extends BaseCardProps {
  imageSrc: string;
  imageAlt?: string;
  title?: string;
  description?: string;
}

interface ListItem {
  id: string | number;
  content: string;
  icon?: string;
}

interface ListCardProps extends BaseCardProps {
  title?: string;
  items: ListItem[];
}

interface HoverCardProps extends BaseCardProps {
  hoverContent?: React.ReactNode | string;
  hoverDelay?: number;
}

Component Methods

All card components share common methods:

  • getElement(): HTMLElement - Get the card DOM element
  • setVariant(variant: CardVariant): void - Change the visual variant
  • mount(container: HTMLElement): void - Mount the card to a container
  • unmount(): void - Remove the card from the DOM

Component-specific methods:

ImageCard:

  • setImage(src: string, alt?: string): void - Update the image
  • setTitle(title: string): void - Update the title
  • setDescription(description: string): void - Update the description

ListCard:

  • setItems(items: ListItem[]): void - Update all items
  • addItem(item: ListItem): void - Add a single item
  • removeItem(id: string | number): void - Remove an item by ID
  • setTitle(title: string): void - Update the title

HoverCard:

  • setHoverContent(content: string | HTMLElement): void - Update hover content
  • setHoverDelay(delay: number): void - Update hover delay
  • setContent(content: string | HTMLElement): void - Update main content
  • destroy(): void - Clean up event listeners and remove from DOM

Building

npm run build

License

MIT