# File list with status

- **[App UI](/app/)**
- **[Files](/app/files/)**
- **File list with status**

Files and where each one is: uploading (a native progress bar with its percentage), done, or failed with a reason and Retry.

## Notes

- **When to use it**: A status list for uploads and stored files, where each row shows a name, a size and a word for its state. Pair it with `app-files-dropzone` when people also add files; use `app-data-table` instead when the rows need sorting or many columns.
- **Writing for it**: - Each file name holds 60 characters and the size 20, so write sizes as '1.2 MB' and keep long names short enough to read without a tooltip.
- percent is text of at most 4 characters, such as '60'. Only an uploading row draws the bar from it, so a done row can carry '100' and nothing breaks.
- A failed row should carry a reason (80 characters) that tells the person what to do next. Without it the row only says Failed and offers Retry.
- **Watch out for**: Retry does not upload anything. It restarts the row at the restartAt percentage as a stand-in, and your app has to drive the real number. The list holds 1 to 8 files, and removing the last one switches to the empty message.

## Pairs well with

- **[App, upload drop zone](/blocks/app/files-dropzone)**
- **[App, data table](/blocks/app/data-table)**
- **[App, profile settings](/blocks/app/settings-profile)**

## Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import AppFilesList from '@/components/klarhimmel/blocks/app-files-list';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <AppFilesList props={{
          "eyebrow": "Files",
          "title": "Uploads",
          "description": "Say whose files these are.",
          "files": [
            {
              "name": "first-file.pdf",
              "size": "0.0 MB",
              "status": "done",
              "percent": "100"
            },
            {
              "name": "second-file.jpg",
              "size": "0.0 MB",
              "status": "uploading",
              "percent": "60"
            },
            {
              "name": "third-file.pdf",
              "size": "000 KB",
              "status": "failed",
              "percent": "0",
              "reason": "Say why it failed."
            }
          ],
          "statusLabels": {
            "uploading": "Uploading",
            "done": "Done",
            "failed": "Failed"
          },
          "actions": {
            "retry": "Retry",
            "remove": "Remove"
          },
          "notices": {
            "retrying": "Say it restarted:",
            "removed": "Removed:"
          },
          "restartAt": "25",
          "state": "filled",
          "messages": {
            "emptyTitle": "No files yet",
            "emptyBody": "Say what makes files appear here."
          }
        }} />
      </BlockSurface>
    </Theme>
  );
}
```

## Props

The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.

- **eyebrow**: Text, up to 60 characters. Optional; empty is not rendered.
- **title**: Text, up to 120 characters.
- **description**: Text, up to 300 characters. Optional; empty is not rendered.
- **files**: List of 1 to 8. Each item: name, size, status ('uploading' | 'done' | 'failed'), percent, reason (optional).
- **statusLabels**: Fields: uploading, done, failed.
- **actions**: Fields: retry, remove.
- **notices**: Fields: retrying, removed.
- **restartAt**: Text, up to 4 characters.
- **state**: One of 'filled', 'empty'.
- **messages**: Fields: emptyTitle, emptyBody.
- **headingLevel**: One of '1', '2'. Optional; empty is not rendered.

## Install

- **CLI**

  ```
  npx shadcn add @klarhimmel/app-files-list
  ```

Uses

- Badge
- Button
- EmptyState

- **About**: Files and where each one is: uploading (a native progress bar with its percentage), done, or failed with a reason and Retry.
- **States**: Uploading, done and failed rows, and an empty list. Retry restarts a row, Remove deletes it; both name their file and report in a live region. New project? Set it up once: /get-started/installation.
