Skip to content

Img ​

Lazy image with ratio, placeholder, error

An image that reserves its space, shows a skeleton or a blurred placeholder while it loads, and a marked fallback if it fails. alt is required: describe what the image shows, or pass alt="" for decoration.

Basic
Episode 1第1話Episode 3Missing still
  • ratio holds the space before load, so nothing jumps. loading="eager" for the image at the top of the page.
  • A broken image shows the error mark, named by alt, instead of the browser's broken-image icon.

Usage ​

ts
import { BlessImg } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
src*string—
alt*string—
ratiostring | number—e.g. 16 / 9 or "4 / 5"; omit to use the image's own
fit"fill" | "none" | "cover" | "contain""cover"
loading"lazy" | "eager""lazy"eager for above-the-fold images
placeholderstring—tiny blurred placeholder (data URL / LQIP)
srcsetstring—
sizesstring—

Slots

NameScopeDescription
error—
default—

Released under the MIT License. Character names and artwork belong to their owners.