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-card-video

v0.76.5

Published

Bulma `card` with a 16:9 `image` frame: YouTube embed when `provider` is `youtube`, otherwise an HTML5 `<video>` with MP4 source. Optional title, truncated description (100 chars), formatted `time` via Day.js (`dateformat`), “read more” primary button, an

Downloads

5,657

Readme

hb-card-video — card-video

Category: media | Tags: media, video

Summary

A Bulma card with a fixed 16:9 media area at the top, optional title and description, optional timestamp in the footer, and optional “share + action” row when a page URL is supplied. The media area is either an HTML5 <video> (MP4 source) or a YouTube iframe embed, depending on provider.

Behavior: native video vs YouTube

  • provider is "youtube" — Renders an <iframe> inside Bulma’s image is-16by9 figure. Set videosrc to the full embed URL (for example https://www.youtube.com/embed/VIDEO_ID). The iframe uses allowfullscreen and a static title of YouTube video for accessibility.
  • Any other provider (including omitted or empty) — Renders a native <video controls> with a single <source src={videosrc} type="video/mp4">, plus an empty captions <track> placeholder. The figure uses has-background-black behind the letterboxed frame.

Browsers that do not support <video> see the fallback text inside the video element.

Layout

Structure follows Bulma’s card pattern:

  1. card-image — 16:9 figure (image is-16by9) containing either the iframe or the video.
  2. card-content — Optional title (title is-5), optional description block, then (only if pageuri is set) Facebook “like” placeholder markup, a Twitter intent link styled as twitter-share-button, a line break, and optionally a primary button when linklabel is non-empty.
  3. card-footer — Rendered only when time is set. It wraps a named slot (see Slots) whose default content is a small grey line with a clock icon and the formatted date/time.

The root inner wrapper uses hb-card-video-root with flex column layout so the card can stretch vertically (card-content grows with flex: 1).

Logic

  • Description — If description is longer than 100 characters, the UI shows only the first 100 characters (no ellipsis added in markup).
  • time + dateformat — When time is provided, the footer shows Day.js–formatted text. Default dateformat is dddd DD MMMM YYYY HH:mm. The formatter uses navigator.language as the Day.js locale, then applies a small transform that uppercases the first letter of each word in the formatted string.
  • pageuri — When set, the content area includes Facebook (fb-like div with data-href, etc.) and Twitter (twitter-share-button / intent URL) placeholder markup. Those widgets only become interactive if the host page loads the corresponding third-party scripts and initializes them; this component does not bundle those SDKs.
  • linklabel — Defaults to read more. The primary <a class="button is-primary"> is rendered only when pageuri is set and linklabel is truthy with non-zero length (so an empty string hides the button even if pageuri is set).

Custom element tag

hb-card-video

Attributes (names as in typings; string values from HTML)

From HTML / setAttribute, values are strings (dates as parseable strings, for example ISO 8601). Use the same attribute names as in the table below (aligned with this package’s typings and custom-element props).

| Attribute | Required | Description | | --- | --- | --- | | videosrc | Yes | URL for the MP4 source (native video) or the full YouTube embed URL (provider="youtube"). | | provider | No | Set to youtube for iframe mode; omit or use an empty string for native <video>. | | title | No | Card heading (title is-5). | | description | No | Body paragraph; truncated to 100 characters in the UI when longer. | | pageuri | No | Canonical URL passed into share placeholders and the optional primary button href. | | linklabel | No | Label for the primary button when pageuri is set; implementation default read more. | | time | No | When set, shows the footer with formatted clock line (or slot content). Use a string the runtime can treat as a Date (for example 2026-03-01T12:00:00.000Z). | | dateformat | No | Day.js format string; default dddd DD MMMM YYYY HH:mm. | | id | No | Passed through for the host / styling hooks. |

Events

None. The public Events type is {} — no custom CustomEvent payloads are declared for this component.

Styling

The shadow tree bundles Bulma 1.x pieces needed for the card, image ratio, typography, button, and content spacing. Bootstrap Icons are loaded for the footer clock icon (see styles/webcomponent.scss).

CSS custom properties

| Variable | Role | | --- | --- | | --bulma-black | Background behind the 16:9 native video frame (has-background-black). | | --bulma-primary | Primary button (is-primary) for the pageuri action. | | --bulma-text | Title and body copy. | | --bulma-link | Link-toned controls where Bulma applies link styling. |

Other --bulma-* variables from the bundled Bulma setup may apply on :host; see Bulma CSS variables.

CSS parts (::part)

None exposed (cssParts is empty in extra/docs.ts).

HTML slots

| Slot | Description | | --- | --- | | card-footer | Named slot inside card-footer, only when time is set. Default slot content is the formatted timestamp row (clock icon + Day.js output). If you supply slotted content for card-footer, it replaces that default (standard slot behavior), while the outer <footer class="card-footer"> wrapper remains. |

Typings (types/webcomponent.type.d.ts)

export type Component = {
  id?: string;
  title?: string;
  description?: string;
  videosrc: string;
  provider?: "youtube" | "";
  pageuri?: string;
  linklabel?: string;
  time?: Date;
  dateformat?: string;
};

export type Events = {};

Use this shape for TypeScript wrappers, Storybook args, or casts when querying the host element. Remember that DOM attributes are still strings at the boundary even when typings use Date for time.

Example

Native MP4

<hb-card-video
  videosrc="https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4"
  title="Product tour"
  description="A short walkthrough of the dashboard."
  time="2026-03-01T12:00:00.000Z"
  dateformat="MMM D, YYYY"
  pageuri="https://example.com/posts/product-tour"
  linklabel="Open post"
></hb-card-video>

YouTube embed

<hb-card-video
  videosrc="https://www.youtube.com/embed/dQw4w9WgXcQ"
  provider="youtube"
  title="Sample clip"
  description="Embedded iframe player."
  time="2024-01-01T12:00:00.000Z"
></hb-card-video>