Image

A responsive image with a layout-stable box, srcset and sizes, focal point, placeholder and fallback, built on the native <img> and <picture> elements.

UIimageView JSON

The box reserves the aspect ratio before the file arrives, so the surrounding layout never shifts. `widths` and `transform` build the srcset, `sizes` lets the browser choose a candidate, and the placeholder stays visible until the image loads. `placeholder` is either a CSS color or an image URL drawn cover/center; decode a blurhash to a low-quality image URL first. The component is a native `<img>` (or `<picture>` when `sources` is set), so it works in every framework and can be replaced by a framework image component without changing the rest of the page.

Preview

The launch vehicle on the pad

Installation

Add the item with the shadcn CLI, or copy the source manually.

pnpm dlx shadcn@latest add litingyes/blocove/image

Requires a shadcn/ui project set up with Base UI primitives. Blocove is developed against the b0 preset, but it installs no base config or theme tokens: your own preset, fonts and colors stay in place.

Or install from the namespace after adding the registry: npx shadcn@latest add @blocove/image

API Reference

Props accepted by the exported components.

Image

The responsive image. The box keeps the aspect ratio, paints the placeholder and exposes `data-state`; the `<img>` inside stays a plain native element.

PropTypeDefault
srcstringRequired
altstringRequired
widthnumber-
heightnumber-
aspectRationumber | stringwidth / height
srcSetstring-
sizesstring-
widthsreadonly number[]-
transform(src, width) => stringIdentity
sourcesreadonly ImageSource[]-
prioritybooleanfalse
focalPoint{ x: number, y: number }-
objectFitCSSProperties['objectFit']'cover'
placeholderstring-
fallbackReactNode-
containerClassNamestring-
classNamestring-
...propsImgHTMLAttributes<HTMLImageElement>-