Skip to content

Thumbnail

Square image preview for attachments and media.

Preview
<Thumbnail
alt="Preview"
label="photo.jpg"
src="https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=160&h=160&fit=crop"
/>
<Thumbnail
alt="Preview"
label="Open photo.jpg"
src="https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=160&h=160&fit=crop"
onClick={fn()}
/>
Preview
<Thumbnail
alt="Preview"
label="Remove photo.jpg"
src="https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=160&h=160&fit=crop"
onRemove={fn()}
/>
Preview
<Thumbnail
alt="Preview"
label="photo.jpg"
src="https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=160&h=160&fit=crop"
isDisabled
onClick={fn()}
onRemove={fn()}
/>
Preview
<Thumbnail
alt="Preview"
label="Uploading photo.jpg"
src="https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=160&h=160&fit=crop"
isLoading
/>
Broken preview
<Thumbnail
alt="Broken preview"
label="Broken image"
src="/missing-thumbnail-image.jpg"
/>
<Thumbnail
alt="Preview"
label="Open or remove photo.jpg"
src="https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=160&h=160&fit=crop"
onClick={fn()}
onRemove={fn()}
/>
Preview
<HStack gap={3}>
<Thumbnail
alt="Preview"
label="photo.jpg"
src="https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=160&h=160&fit=crop"
/>
<Thumbnail isLoading label="Uploading" />
<Thumbnail label="Missing image" />
</HStack>

Square image preview for attachments and media.

PropTypeDefaultDescription
altstringAlt text describing the image content. Use label for a file name or action label shown in the tooltip and button accessible names.
classNamestringAdditional CSS class names applied to the root.
data-testidstringTest ID applied to the root.
isDisabledbooleanfalseWhether the thumbnail is disabled.
isLoadingbooleanfalseWhether the thumbnail is loading.
labelstringFile name or short item label used for the root accessible name, tooltip, and open/remove button labels. When omitted, alt is used as a fallback.
onClick(event: MouseEvent<HTMLButtonElement>) => voidCalled when the thumbnail image area is clicked.
onRemove(event: MouseEvent<HTMLButtonElement>) => voidCalled when the remove button is clicked.
refRef<HTMLDivElement>Ref forwarded to the root element.
srcstringImage source.
styleCSSPropertiesInline styles applied to the root.