bloxa

Image

FREE

Image with a loading placeholder, soft fade-in, error fallback, aspect ratio, caption and hover zoom.

Installation

Terminal
npx @bloxa/cli add image
# or: npx shadcn@latest add @bloxa/image

Examples

Ratio, caption and zoom

A placeholder shows until the image loads, then it fades in.

Sunset over desert dunes
Fades in once loaded; the frame keeps its ratio.

Error fallback

When loading fails, a localized message or your own content is shown.

Product photo

Corners and fit

Dunes, square
Dunes, rounded
Dunes, circle
Dunes, contained

API reference

Every component also accepts the props of the element it renders.

Image

PropTypeDefaultDescription
altstring—Required description; "" for decorative images.
rationumber | string—Frame aspect ratio, e.g. 16 / 9 or "4/3".
fit"cover" | "contain""cover"How the image fills the frame.
rounded"none" | "sm" | "md" | "lg" | "full""md"Corner radius.
fallbackReactNode—Content shown when loading fails.
captionReactNode—Caption; wraps in figure/figcaption.
zoomOnHoverbooleanfalseGentle zoom on hover.
frameClassNamestring—Class for the outer frame (className goes to the img).