Thumbnail
A media preview with independent loading, uploading, and removal states.
A media preview with independent loading, uploading, and removal states.
The examples use photographs from Unsplash by ConfinedRiley, Tim G, and Sebastian Schuster.
Import
Section titled “Import”import { Lightbox, Thumbnail } from "@zentara-co/zenos-ui";Size and aspect ratio
Section titled “Size and aspect ratio”Thumbnail defaults to a 64px square. It intentionally has no named size or ratio prop; use className to match the application context. The image always covers the available frame.
Custom styling
Section titled “Custom styling”Use className to customize the frame, dimensions, shape, and surface. Scope styles to the stable data-slot attributes when an application needs to refine the image, preview action, loading state, upload overlay, or remove control without replacing Thumbnail behavior.
Loading, uploading, and fallback
Section titled “Loading, uploading, and fallback”Loading replaces the preview with a Skeleton while source data is pending. Uploading preserves the available image and overlays a Loader. They are separate states: do not use upload progress to represent an image that has not loaded yet. Missing or failed sources use the image placeholder.
Loading
Uploading
Placeholder
Disabled
Lightbox preview
Section titled “Lightbox preview”Use each thumbnail’s onClick to set the active gallery index and open Lightbox. Keep index and
onIndexChange controlled so selecting a thumbnail and navigating inside Lightbox stay in sync.
Preview and removal
Section titled “Preview and removal”onClick turns the image into a preview button. onRemove adds a separate overlaid remove button and stops its click from opening the preview. Thumbnail does not own a viewer; compose it with Lightbox or another application destination.
3 files attached.
Remove visibility
Section titled “Remove visibility”Hover visibility keeps dense attachment grids quiet while still revealing the button on keyboard focus and coarse pointers. Use always when removal is the primary task or hidden controls would be difficult to discover.
Hover
Always
Variants
loadedisLoadingisUploadingdisabledremove: hoverremove: always API
| Prop | Type | Default | Description |
|---|---|---|---|
src / alt | string | — | Image source and alternative text. |
label | string | — | Accessible file name, group label, and native hover title. |
isLoading | boolean | false | Replaces preview with a skeleton. |
isUploading | boolean | false | Shows upload progress over preview. |
disabled | boolean | false | Disables preview and remove interactions. |
onClick | MouseEventHandler<HTMLButtonElement> | — | Makes the preview actionable and handles activation. |
onRemove | MouseEventHandler<HTMLButtonElement> | — | Shows and handles the independent remove control. |
showRemoveOn | always | hover | hover | Controls persistent or interaction-revealed removal. |
native props | React.HTMLAttributes<HTMLDivElement> | — | Forwards native attributes, events, aria-*, data-*, className, style, and ref. |
Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props,
including className, style, aria-*, and data-*.
Accessibility
Section titled “Accessibility”Use alt to describe meaningful image content. Omit it for decorative media; Thumbnail then hides the image from assistive technology. When the preview is actionable, label, then alt, supplies the button name. A remove action is named “Remove” plus the file label. Loading is decorative; uploading includes a named Loader but applications should announce completion separately when it matters. Disabled preview and remove controls retain native disabled behavior.