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

@htmlbricks/hb-contact-item

v0.76.5

Published

Single contact line (mutually exclusive props): phone, postal address, email, website, or social network. Renders a Bootstrap Icon and optional visible text; JSON `config` toggles icons (filled/outline), label text, and whether clicks dispatch `contactCli

Readme

hb-contact-item — contact-item

Category: content | Tags: content, contact

What it does

Renders a single contact row: one of phone, postal address, email, website, or social profile. Each variant shows a Bootstrap Icon (when enabled) and optional label text. Behavior is controlled by a JSON config object: show or hide the icon column, show or hide text, and choose whether a click should window.open a URL or dispatch a contactClick custom event with the active mode and payload.

Evaluation order is fixed: if multiple inputs are present, phone wins, then social, address, email, and site. In practice you should pass only one contact type per instance.

Custom element

hb-contact-item

Attributes / props (snake_case)

Web component attributes are strings. Objects must be passed as JSON (single-line attribute values are typical). Property names on the element use snake_case; keys inside the JSON payloads follow the TypeScript shapes below (camelCase where noted).

| Attribute | Type | Description | | --- | --- | --- | | id | string (optional) | Host-controlled identifier; forwarded like any HTML id when set by the runtime. | | style | string (optional) | Inline style string on the host element. | | phone | JSON (optional) | IPhone: number (required), callOnClick (optional boolean). The value is included in contactClick detail; the component does not open tel: URLs by itself—handle dialing or navigation in your listener if needed. | | address | JSON (optional) | IAddress: address (required), shortAddress (optional), mapUri (optional), latLang (optional number array [lat, lng]). If mapUri or latLang is set, a click opens a map URL (latLang becomes a Google Maps query URL; if both latLang and mapUri exist, mapUri wins). | | email | JSON (optional) | IEmail: address (required), mailLink (optional boolean). If mailLink is true, a click calls window.open with address as the URL string—use a full URL (for example mailto:[email protected]) so the browser can open the mail client. | | site | JSON (optional) | ISite: uri (optional), label (optional), open (optional boolean). Display text is label if set, otherwise uri. If open is true and uri is set, a click opens uri in a new window. | | social | JSON (optional) | ISocial: name (required), label (optional), pageUri (optional). The icon class is bi bi-{name} (Bootstrap Icons suffix only, without the bi- prefix). If pageUri is set, a click opens that URL. | | config | JSON (optional) | IConfig: icon (optional object with optional fill boolean), text (optional boolean), dispatcher (optional boolean). Defaults applied in logic: icon.fill defaults to false if icon exists; text defaults to true unless explicitly false; dispatcher defaults to true unless explicitly false. The fill flag is accepted for forward compatibility but does not currently switch icon classes in markup. |

Click behavior (summary)

  1. If the row is configured to open a window (social pageUri, address map link, email with mailLink, or site with open + uri), the first click runs window.open with the resolved URL. contactClick is not fired in that branch.
  2. Otherwise, if config.dispatcher is not disabled, a click dispatches contactClick with detail { action, options }:
    • action: "phone" | "social" | "address" | "email" | "site" (whichever branch is active).
    • options: the parsed object for that branch (same shape as the corresponding prop).

The root span gets a clickable affordance (Bulma is-clickable) when a window URL will be used on click.

CSS custom properties

None are declared for this component in styleSetup. The shadow tree loads Bulma helpers for layout and Bootstrap Icons for glyphs. Surrounding page typography and colors affect only the host, not inner defaults beyond Bulma utilities.

CSS parts (::part)

| Part | Description | | --- | --- | | iconcell | Wrapper around the leading icon column (when config.icon is truthy). | | prop | Text span for the visible value (when config.text is enabled). |

HTML slots

None.

Events (CustomEvent)

| Event | detail | When it fires | | --- | --- | --- | | contactClick | { action: string; options: ... }options matches the active phone / address / email / site / social object | On click when no window.open URL is resolved for that row and config.dispatcher is true (default). |

Usage notes

  • Prefer one of phone, address, email, site, or social per element to avoid surprising precedence.
  • Escape JSON correctly in HTML attributes when needed (for example use single quotes around the attribute value and double quotes inside the JSON string).
  • Social name must be a valid Bootstrap Icons glyph name fragment (for example facebook, linkedin, twitter-x).
  • Bootstrap Icons CSS is injected from the component (svelte:head / shadow stylesheet); no extra icon font link is required on the host page for the shadow tree.
  • There is no built-in i18n catalog for this package; labels come entirely from your JSON props.

Minimal HTML examples

Email row (click opens mail client via mailto:):

<hb-contact-item
  email='{"address":"mailto:[email protected]","mailLink":true}'
  config='{"text":true,"dispatcher":true}'
></hb-contact-item>

Email row (no automatic navigation—handle contactClick):

<hb-contact-item
  email='{"address":"[email protected]"}'
  config='{"dispatcher":true}'
></hb-contact-item>

Phone row (integrator handles contactClick):

<hb-contact-item
  phone='{"number":"+39 02 1234567","callOnClick":true}'
></hb-contact-item>

Address with external map link:

<hb-contact-item
  address='{"address":"Via Example 42, Milan, Italy","shortAddress":"Milan HQ","mapUri":"https://www.openstreetmap.org/search?query=Milan"}'
></hb-contact-item>

Website with new-tab behavior:

<hb-contact-item
  site='{"label":"Company site","uri":"https://example.com","open":true}'
  config='{"text":true,"icon":{"fill":false}}'
></hb-contact-item>

Listening from JavaScript

const el = document.querySelector("hb-contact-item");
el.addEventListener("contactClick", (e) => {
  const { action, options } = e.detail;
  // action: "phone" | "address" | "email" | "site" | "social"
  // options: payload object for that action
});