File Item
FileItem displays a file with its thumbnail, metadata, and upload state.
import { FileItem } from '@/components/ui/wideset/file-upload/FileItem';
<FileItem onRemove={() => remove(file)}>
<FileItem.Thumbnail name="q3-report.pdf" />
<FileItem.Title>q3-report.pdf</FileItem.Title>
<FileItem.Description>1.2 MB</FileItem.Description>
</FileItem>Installation
pnpm dlx wideset add file-item
Copies the component and any Wideset components it uses into your project.
Examples
Variants
Contained gives the row a tinted background and padding, so it stands on its own in a form or on a busy surface. Uncontained drops both and lines the file up with the text around it, for lists inside a card or a side panel that already frame it. Keep one variant per list.
import { FileItem } from '@/components/ui/wideset/file-upload/FileItem';
const remove = () => {};
export default function FileItemVariants() {
return (
<div className="gap-ws-9 flex w-[24rem] max-w-full flex-col">
{(['contained', 'uncontained'] as const).map((variant) => (
<FileItem key={variant} variant={variant} onRemove={remove}>
<FileItem.Thumbnail name="q3-report.pdf" />
<FileItem.Title>q3-report.pdf</FileItem.Title>
<FileItem.Description>1.2 MB</FileItem.Description>
</FileItem>
))}
</div>
);
}Thumbnails
Give the thumbnail the file name and it picks the kind from the extension: PDF, spreadsheet, document, video, image; anything it does not know, like .zip, shows as a document. To pin it yourself, pass src for a real preview (an object URL of the picked image), type for a kind, or icon for your own glyph. Leave a preview's alt empty: the title already names the file for screen readers.
import { RiMusic2Fill } from '@remixicon/react';
import { FileItem } from '@/components/ui/wideset/file-upload/FileItem';
const files = [
{ name: 'q3-report.pdf', size: '1.2 MB' },
{ name: 'budget-2026.xlsx', size: '640 KB' },
{ name: 'project-brief.docx', size: '88 KB' },
{ name: 'product-demo.mp4', size: '48 MB' },
{ name: 'team-photo.jpg', size: '3.4 MB' },
{ name: 'assets.zip', size: '12 MB' },
];
const PREVIEW =
'https://images.unsplash.com/photo-1492633423870-43d1cd2775eb?&w=128&h=128&dpr=2&q=80';
const remove = () => {};
export default function FileItemThumbnails() {
return (
<div className="gap-ws-5 flex w-[24rem] max-w-full flex-col">
{files.map((file) => (
<FileItem key={file.name} onRemove={remove}>
<FileItem.Thumbnail name={file.name} />
<FileItem.Title>{file.name}</FileItem.Title>
<FileItem.Description>{file.size}</FileItem.Description>
</FileItem>
))}
<FileItem onRemove={remove}>
<FileItem.Thumbnail src={PREVIEW} alt="" />
<FileItem.Title>portrait.jpg</FileItem.Title>
<FileItem.Description>2.1 MB</FileItem.Description>
</FileItem>
<FileItem onRemove={remove}>
<FileItem.Thumbnail icon={RiMusic2Fill} />
<FileItem.Title>podcast-episode-12.mp3</FileItem.Title>
<FileItem.Description>9.8 MB</FileItem.Description>
</FileItem>
</div>
);
}States
Uploading swaps the remove button for a spinner, and the description's second item (time left) follows a divider. Done shows the remove button, labelled "Remove" plus the file name for screen readers. Failed tints the row and shows a warning icon; error is the headline under the row, and any other child lands beneath it, which is where you say how to fix it.
import { FileItem } from '@/components/ui/wideset/file-upload/FileItem';
const remove = () => {};
export default function FileItemStates() {
return (
<div className="gap-ws-5 flex w-[24rem] max-w-full flex-col">
<FileItem isLoading>
<FileItem.Thumbnail name="product-demo.mp4" />
<FileItem.Title>product-demo.mp4</FileItem.Title>
<FileItem.Description>
48 MB
{'4 seconds left'}
</FileItem.Description>
</FileItem>
<FileItem onRemove={remove}>
<FileItem.Thumbnail name="q3-report.pdf" />
<FileItem.Title>q3-report.pdf</FileItem.Title>
<FileItem.Description>1.2 MB</FileItem.Description>
</FileItem>
<FileItem error="File exceeds the 25 MB limit" onRemove={remove}>
<FileItem.Thumbnail name="assets.zip" />
<FileItem.Title>assets.zip</FileItem.Title>
<FileItem.Description>48 MB</FileItem.Description>
<span className="typography-body-md text-ws-static-base">
Split the archive or upload the files one by one.
</span>
</FileItem>
</div>
);
}API reference
FileItem
| Name | Description | Default |
|---|---|---|
defaultMotion | Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`. boolean | true |
error | Error headline under the row, in the negative colour. Implies `hasError`. ReactNode | — |
hasError | The upload failed: danger tint (contained) and a warning icon. Figma's `Type=Error`. boolean | false |
isLoading | The upload is in flight: a spinner replaces the remove button and the row takes Figma's wider `Uploading` gap. Same as placing `FileItem.Loading`. boolean | false |
onRemove | Shows the remove button (hidden while loading). (() => void) | — |
removeLabel | Accessible label for the remove button. Defaults to `Remove <title>`. string | — |
variant | 'contained''uncontained' | 'contained' |
FileItem.Description
<span> is passed through to it. See MDN: <span>.FileItem.Loading
<span> is passed through to it. See MDN: <span>.FileItem.Thumbnail
| Name | Description | Default |
|---|---|---|
alt | Alternative text. Pass `""` when the picture is decorative. Alternative text. Pass `""` when the logo is decorative. string | — |
icon | Glyph drawn on the purple tile. Defaults to a bar chart, as in Figma. RemixiconComponentType | — |
mimeType | MIME type of the file; takes precedence over the extension when inferring the kind. string | — |
name | File name. When no `type`, `src`, `text` or `icon` is given, the file kind is read off its extension — `report.pdf` shows the PDF tile. string | — |
size | Figma's `Size` axis: 16 / 20 / 24 / 32 / 40px. ThumbnailSize | 'lg' |
src | Picture that fills the tile edge to edge. Logo drawn at glyph size on a white tile with a subtle border. string | — |
text | Short label — a letter or two — drawn on the purple tile. string | — |
type | A kind of file. The glyph and hue are fixed per kind. 'image' | 'text' | 'icon' | 'logo' | ThumbnailFileType | — |
FileItem.Title
<span> is passed through to it. See MDN: <span>.Accessibility
- The remove button is named “Remove <title>” when
FileItem.Titleholds plain text; passremoveLabelotherwise, and to translate. - The spinner and the error icon are hidden from screen readers, and nothing is announced when a row changes state. Announce finished or failed uploads yourself.
- Give a
srcpreview an emptyalt; the title already names the file.
| Part | Renders | Description |
|---|---|---|
| FileItemRenders no element | — | A file row with metadata and upload feedback. |
| FileItem.DescriptionRenders no element | <span> | Several children are separated by a thin vertical rule — `1.2 MB | 2 seconds left`. |
| FileItem.LoadingRenders no element | <span> | An upload-in-progress indicator. |
| FileItem.ThumbnailRenders no element | — | A file preview inferred from its name, MIME type, or explicit content. |
| FileItem.TitleRenders no element | <span> | The primary title text. |
import { FileItem } from '@/components/ui/wideset/file-upload/FileItem';
<FileItem onRemove={() => remove(file)}>
<FileItem.Thumbnail name="q3-report.pdf" />
<FileItem.Title>q3-report.pdf</FileItem.Title>
<FileItem.Description>1.2 MB</FileItem.Description>
</FileItem>