This is a web component for embedding images from HTTP Cats.
Here's a live demo.
npm install @http.cat/http-cat-element
If installed via NPM:
import "@http.cat/http-cat-element";
Or just import the component file in your HTML:
<script type="module" src="http-cat.js"></script>
To use it just add the following markup to your HTML:
<http-cat status="404"></http-cat>
status
: change it so that the image matches the corresponding HTTP status code
This component supports all img
element attributes.
Safari does not currently support custom elements that extend native elements. Therefore, an autonomous custom element is used to ensure maximum browser compatibility.
MIT License