Attachment list
Files with a thumbnail or mark, size, upload progress, retry, remove and download.
import { AttachmentList } from "@forgeron/ui";- invoice-214.pdf
- recording.mp4
- archive.zip
import { AttachmentList } from "@forgeron/ui";
export default function Default() {
return (
<div style={{ width: "100%", maxWidth: 420 }}>
<AttachmentList
items={[
{ id: "a", name: "invoice-214.pdf", size: 238_000, url: "#" },
{ id: "b", name: "recording.mp4", size: 48_000_000, progress: 0.35 },
{ id: "c", name: "archive.zip", size: 900_000_000, error: "over the 25 MB limit" },
]}
onRemove={() => {}}
onRetry={() => {}}
/>
</div>
);
}import { AttachmentList } from "@forgeron/ui";
const dot =
"data:image/svg+xml;utf8," +
encodeURIComponent(
'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8"><rect width="8" height="8" fill="#888"/><rect width="4" height="4" fill="#bbb"/><rect x="4" y="4" width="4" height="4" fill="#bbb"/></svg>',
);
export default function Grid() {
return (
<AttachmentList
layout="grid"
items={[
{ id: "a", name: "mockup.png", type: "image/png", size: 310_000, thumbnail: dot, url: "#" },
{ id: "b", name: "notes.txt", size: 1200, url: "#" },
]}
/>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
items | { id, name, size?, type?, url?, thumbnail?, progress?, error? }[] | — | progress 0 to 1 while uploading; error marks it failed. |
onRemove / onRetry | (item) => void | — | Show the buttons. |
layout / label | "list" | "grid"; string | — | Rows, or tiles for pictures. |
className | string | — | Extra classes. |