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
Light test image
Dark test image
<HStack gap={3}>
<Thumbnail {...args} />
<Thumbnail
{...args}
alt="Light test image"
label="light-image.jpg"
src={solidImage('#ffffff')}
/>
<Thumbnail
{...args}
alt="Dark test image"
label="dark-image.jpg"
src={solidImage('#22272d')}
/>
</HStack>
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
altstring—Alt text describing the image content. Use label for a file name or action label shown in the tooltip and button accessible names.
classNamestring—Additional CSS class names applied to the root.
data-testidstring—Test ID applied to the root.
isDisabledbooleanfalseWhether the thumbnail is disabled.
isLoadingbooleanfalseWhether the thumbnail is loading.
labelstring—File 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>) => void—Called when the thumbnail image area is clicked.
onRemove(event: MouseEvent<HTMLButtonElement>) => void—Called when the remove button is clicked.
refRef<HTMLDivElement>—Ref forwarded to the root element.
srcstring—Image source.
styleCSSProperties—Inline styles applied to the root.