Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hirasso/thumbhash-custom-element

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hirasso/thumbhash-custom-element

A custom element that renders a thumbhash placeholder for your lazy-loaded images 🎨

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-97.13%
Maintainers
0
Weekly downloads
 
Created
Source

<thumb-hash>

A custom element that automatically renders a thumbhash placeholder for your lazy-loaded images 🎨

Test status License

Demo

thumbhash-custom-element.netlify.app

Installation

Install from npm and import it into your bundle:

npm i thumbhash-custom-element
import defineThumbhashElement from "thumbhash-custom-element";
defineThumbhashElement();

Or include the minified production file from a CDN:

<script src="https://unpkg.com/thumbhash-custom-element@0"></script>
<script>
  defineThumbhashElement();
</script>

Usage

Markup

If the script is installed an initialized, you can render thumbhash placeholders automatically by using the custom element:

<figure>
  <thumb-hash value="YTkGJwaRhWUIt4lbgnhZl3ath2BUBGYA" aria-hidden="true"></thumb-hash>
  <img src="{{ url }}" loading="lazy" width="{{ width }}" height="{{ height }}" alt="{{ alt }}">
</figure>

Styling

figure,
figure img {
  position: relative;
}
thumb-hash {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

FAQs

Package last updated on 09 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc