Talisman LogoTalisman Logo Design System
Browse documentation
Components

File upload cards

A drop zone with a list of document cards, where the host owns validation, uploads and row actions.

Stableimport { FileUploadCards } from "@repo/ui/file-upload-cards";Source
Arraste os documentos aqui

PDF até 15 MB

ou

Choose files or drag them onto the area. The sample keeps them in memory and uploads nothing.

When to use

  • To attach one or a few documents to a task, such as the protocol receipt of a petition.
  • When each file needs a card with its details, progress and actions (remove, retry, replace).
  • In a form step where the file is the main content of the area.

When not to use

  • Many files with extra columns per file. Use File upload table.
  • One file inside a form row. Use Single file uploader.
  • Transfers that the component should run. It does not upload: it reports files and renders what the host gives it.

States

Empty

Arraste os documentos aqui

PDF até 15 MB

ou

With files

Each card shows the name, a description (type, size, progress or an error) and the actions you render. A progress bar shows while isUploading is true.

  • peticao-inicial.pdf
    PDF, 2,4 MB
  • procuracao.pdf
    Enviando… 45%
Arraste os documentos aqui

PDF até 15 MB

Single file

With multiple={false} the drop zone hides once there is a file. Offer a replace action through renderActions and openFileDialog.

  • peticao-inicial.pdf
    PDF, 2,4 MB

Disabled

Arraste os documentos aqui

PDF até 15 MB

ou

Content

  • The title says what to attach: “Anexe o comprovante de protocolo”. The description gives the limits: “PDF até 15 MB”.
  • Describe each file with real information: “PDF, 2,4 MB”, “Enviando… 45%”. On failure, write the reason and offer Retry.
  • Name row actions after the file: “Remover peticao-inicial.pdf”, not “Remover”.

Do and don’t

Anexe o comprovante de protocolo

PDF do protocolo, até 15 MB

ou

DoName what the user must attach and state the limits.
Arquivo

Selecione

ou

Don'tDon't use a generic title. The user does not know which file the slot expects.

Accessibility

  • The choose control is a native button; Enter and Space open the picker. The hidden file input is named by inputLabel and is out of the tab order.
  • Each card’s text sits in a polite live region, so changes to the description (progress, failure) are announced.
  • The progress bar is a Progress with the file name as its accessible name and the percentage as its value.
  • Drop is a mouse and touch convenience only; the picker covers keyboard use.
  • The choose button has a 44px minimum height on small screens and xs size from the sm breakpoint (below 44px, above 24px).
  • Icons are decorative (aria-hidden). Always put failures in the description too.
  • Pass disabled to your own row actions as well; the component does not disable them.

Code

import { FileUploadCards } from "@repo/ui/file-upload-cards";

<FileUploadCards
  accept="application/pdf,.pdf"
  files={files}
  inputLabel="Comprovante de protocolo"
  labels={{
    chooseFiles: "Escolher comprovante",
    description: "PDF até 15 MB",
    or: "ou",
    title: "Anexe o comprovante de protocolo",
  }}
  multiple={false}
  onFilesSelected={handleFilesSelected}
  renderActions={(file) => <RemoveButton file={file} />}
/>;

Props

FileUploadCards
PropTypeDefaultDescription
acceptstring—Value of the input `accept` attribute
classNamestring—Extra classes for the root. Layout only
disabledboolean—Blocks the picker and the drop zone
filesTFile[]—Files to list. The component never changes them
inputLabelstring—Accessible name of the hidden file input
labels{ title: string; description: string; chooseFiles: string; or: string }—Title, description, button and separator copy
multiplebooleantrueAccepts several files. When false, the drop zone hides once there is a file
onFilesSelected(files: File[]) => void—Called with the files picked or dropped. Validate and upload them in the host
renderActions(file: TFile, actions: { openFileDialog: () => void }) => ReactNode—Actions at the end of each row. Receives the file and `openFileDialog`
FileUploadCard (items of files)
PropTypeDefaultDescription
idstring—Stable identity, independent of the name. Required.
namestring—File name shown on the card. Required.
descriptionReactNode—Type, size, progress or error text.
iconReactNode—Decorative icon in a 30 by 36px slot. Defaults to a document icon.
isUploadingboolean—Shows the progress bar for this file.
progressnumber0Percentage from 0 to 100.

Known issues

Issue Effect
The drop zone changes only its fill (bg-surface) while a file is dragged over it, and the drag handlers sit on the root. The highlight is subtle, and a drop anywhere on the root is accepted even outside the dashed area.
The component does not filter dropped files by accept. A dropped file of another type reaches onFilesSelected. The host must validate.
The file description uses paragraphXxs, which is 10px (text-[0.625rem]), and the file name labelXs (12px). Small text for operators in 8 hour sessions on older monitors. Progress and error messages are the hardest to read.
renderActions receives no disabled state. Row actions stay clickable while the zone is disabled unless the host passes disabled to them.
Edit this page on GitHub