Talisman LogoTalisman Logo Design System
Browse documentation
Components

File upload table

A drop zone and a table of the files being sent, with per-row progress, removal and extra columns for classification.

Stableimport { FileUploadTable } from "@repo/ui/file-upload-table";Source

Choose files or drop them on the area. The sample only keeps them in memory.

When to use

  • To upload several documents at once and classify each one, as in the dialog that adds subsidies to a case.
  • When every row needs extra information next to the file (a type, a role) through renderExtras.
  • When the list can grow long and should scroll inside a dialog.

When not to use

  • One file. Use Single file uploader.
  • A few documents shown as cards with actions. Use File upload cards.
  • A list of files already stored. Use Table, since this component is about files that are about to be sent.

Anatomy

Part Role
Drop zone A dashed area that is also a button. After the first file it shrinks to one line.
Title Optional heading with the file count: “Documentos (3)”.
Batch actions Optional tableBatchActions at the right of the title.
Table File (icon, name, size), an optional extra column and the remove action.

The hook that owns the files, the drag state and the transfer is not part of the component. The host passes the list and the handlers.

States

Empty

With files

The icon follows the file extension. A name longer than 30 characters is truncated and shown in a tooltip. A row whose progress is 100 with an empty path, when no batch is pending, gets the error badge.

Documentos (3)

ArquivoAções

peticao-inicial.pdf

2.29 MB

procuracao-assinada-pelo-cliente-final-versao-2.pdf

820.31 KB

comprovante-de-residencia.pdf

302.73 KB

Erro

Uploading

With isPending, a row shows a progress bar while progress is below 100 and it is isUploading or has some progress.

Documentos (2)

ArquivoAções

peticao-inicial.pdf

2.29 MB

procuracao-assinada.pdf

820.31 KB

Extra column

renderExtras adds a column; extrasHeader names it. Use it for a select that classifies the document.

Documentos (2)

ArquivoTipo do documentoAções

peticao-inicial.pdf

2.29 MB

Petição inicial

procuracao-assinada-pelo-cliente-final-versao-2.pdf

820.31 KB

Procuração

Dragging and disabled

Content

  • Pass every string through labels: “Arraste ou selecione os arquivos”, “Adicionar mais arquivos”, “Documento”, “Ações”, “Erro”.
  • removeFileAriaLabel receives the file name and returns “Remover arquivo peticao-inicial.pdf”.
  • Pass extrasHeader too; it has no key in labels.
  • The title names the group in the user’s terms: “Documentos do processo”.

Accessibility

  • The drop zone is a button with aria-label={labels.dropZoneAriaLabel}. Enter and Space open the file picker; a disabled zone is removed from interaction. The input behind it is hidden and out of the tab order.
  • Dropping files is not required: the picker does the same job from the keyboard.
  • The table is a native table with header cells, so row and column relations are read by assistive technology.
  • Each remove button is named with the file name. Its icon is aria-hidden; the button is 32px, above the 24px minimum.
  • A long name is truncated visually; the full name stays in the DOM, and a tooltip shows it on hover.
  • The error badge has text (“Erro”), so the status is not only a color.

Code

import { FileUploadTable } from "@repo/ui/file-upload-table";

<FileUploadTable
  fileType={["file", "tabular"]}
  files={upload.files}
  isDragging={upload.isDragging}
  isPending={upload.isPending}
  labels={labels}
  onChangeFile={upload.onChangeFile}
  onDragLeave={upload.onDragLeave}
  onDragOver={upload.onDragOver}
  onDrop={upload.onDrop}
  removeFile={upload.removeFile}
  scrollable
  title={t("documents")}
/>;

Props

FileUploadTable
PropTypeDefaultDescription
classNamestring—Extra classes for the root. Layout only
disabledboolean—Disables the drop zone button
extrasHeaderstring—Header of the extra column. Falls back to the Portuguese text “Opções”
filesFileRow[]—Rows to list. Each has `file`, `name`, `path`, `progress` and `isUploading`
fileTypestring | string[]—Kind of file accepted: `file` or `pdf` (PDF), `image`, `audio`, `video`, `compressed`, `tabular` or `all`, or a list of them. Sets the input `accept`
isDraggingboolean—Highlights the drop zone while a file is dragged over it
isPendingboolean—A batch is uploading. Shows progress bars and hides the error badge
labelsPartial<FileUploadTableLabels>—Copy of the table. Any key left out falls back to Portuguese text
onChangeFile(event: ChangeEvent<HTMLInputElement>) => void—Change handler of the hidden file input
onDragLeave() => void—Called when a drag leaves the drop zone
onDragOverDragEventHandler<HTMLElement>—Called while a drag is over the drop zone. Call `preventDefault`
onDropDragEventHandler<HTMLElement>—Called when files are dropped. Call `preventDefault`
removeFile(name: string) => void—Called with the file name when the user removes a row
renderExtras(file: FileRow) => ReactNode—Content of an extra column, per row
scrollableboolean—Limits the table height (50vh) and scrolls it
scrollAreaClassNamestring—Replaces the default max height of the scroll area
tableBatchActionsReactNode—Actions next to the title, such as “Remove all”
titlestring—Heading above the table. The file count is added after it
FileRow (items of files)
PropTypeDefaultDescription
fileFile—The browser file. Its size is shown on the row.
namestring—File name. Also the row key and the argument of `removeFile`.
pathstring—Where the file was stored. An empty string with progress 100 means the upload failed.
progressnumber—Percentage from 0 to 100.
isUploadingboolean—With `isPending`, shows the progress bar even at 0%.
FileUploadTableLabels
PropTypeDefaultDescription
addMoreFilesstring—Text of the drop zone when there are files.
columnActionsstring—Header of the actions column.
columnFilestring—Header of the file column.
dragOrSelectFilesstring—Text of the drop zone when empty.
dropZoneAriaLabelstring—Accessible name of the drop zone button.
errorBadgestring—Text of the error badge.
removeFileAriaLabel(fileName: string) => string—Accessible name of each remove button.

Known issues

Issue Effect
labels falls back to Portuguese text, and extrasHeader falls back to “Opções”. The package has copy of its own. An English app that omits a key shows Portuguese.
File names and sizes are raw p elements with text-sm and text-xs, not Typography. They do not follow the type scale.
Rows are keyed by name, and removeFile receives only the name. Two files with the same name share a key (React warns) and a remove can drop the wrong row.
onChangeFile, onDragOver and onDrop are required and the component does nothing with the files itself. Every use needs a hook (the app has useMultiFileUpload). There is no default behavior, so it cannot be used alone.
The tooltip for a long name wraps a p that is not focusable. Keyboard users never see the tooltip; they get the truncated text only.
The remove button is h-8 w-8 (32px) and has no confirmation. It is easy to remove a file by accident on a touch device.
isDragging only changes the border width to border-2. The drag feedback is subtle on a large table.
Edit this page on GitHub