Data display
Image
Rounded-rectangle thumbnail with fallback icon, badges, overlay and floating elements.
import { Image, ImageBadge, ImageOverlay, ImageFloatElement } from "datui";Playground
<Image alt="Thumbnail" size={64} borderRadius="m" />Examples
Images, fallback and parts
HD
Accessibility
- Loaded images render
<img alt>; the fallback hasrole="img"labelled byalt(none whenalt=""). Image.Badgeis decorative;Image.OverlaywithonClickis a button and needsaria-label.- The hover overlay also appears on keyboard focus.
API
Image
Rounded-rectangle thumbnail with a fallback icon. Accepts `Image.Badge`, `Image.Overlay` and `Image.FloatElement` children.
| Prop | Type | Default | Description |
|---|---|---|---|
| alt (required) | string | — | Text alternative. Pass `""` for decorative images. |
| borderEndEndRadius | Radius | — | |
| borderEndStartRadius | Radius | — | |
| borderRadius | Radius | m | |
| borderStartEndRadius | Radius | — | |
| borderStartStartRadius | Radius | — | |
| className | string | — | |
| crossOrigin | CrossOrigin | — | |
| fallbackIcon | ReactNode | — | Icon shown when there is no image or it fails to load. |
| filter | Filter | — | |
| heightSize | string | number | — | Height override (px number or CSS length). |
| keepAspectRatio | boolean | — | Let the image's own aspect ratio set the height. |
| loading | "eager" | "lazy" | — | |
| noBorder | boolean | — | Hide the thin inner border. |
| objectFit | ObjectFit | — | |
| objectPosition | ObjectPosition<string | number> | — | |
| onError | (() => void) | — | |
| onLoad | (() => void) | — | |
| referrerPolicy | HTMLAttributeReferrerPolicy | — | |
| size | number | 48 | Square size in px. Use `widthSize`/`heightSize` for other shapes. |
| sizes | string | — | |
| src | string | — | |
| srcSet | string | — | |
| widthSize | string | number | — | Width override (px number or CSS length). |
| withTransparentBackground | boolean | — | Drop the placeholder background (for transparent images). |
ImageBadge
Small round badge pinned to the bottom-end corner of an `Image` or `Avatar`. Content is decorative.
| Prop | Type | Default | Description |
|---|---|---|---|
| background | "stroke" | "shadow" | stroke | `stroke` cuts the badge out with a background-colored ring; `shadow` lifts it. |
| className | string | — |
ImageOverlay
Layer over an `Image`/`Avatar`, e.g. an edit or play icon. With `onClick` it renders a button — give it an `aria-label`.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | — | |
| disabled | boolean | — | |
| theme | "light" | "dark" | dark | Overlay tint. |
| visibility | "on-hover" | "always" | on-hover | `on-hover` reveals the overlay on hover/focus; `always` keeps it visible. |
ImageFloatElement
Freely positioned element (e.g. a `ContentBadge` or `Counter`) pinned to a corner of an `Image`.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | — | |
| placement | "top-start" | "bottom-start" | "top-end" | "bottom-end" | top-end | Corner to pin to. |