Skip to content
Files SDK
Esc
↑↓navigate↵open⌘Jpreview
On this page

File List

A list of stored files with thumbnails, size and type, plus download and delete — driven by useFiles.

Lists the objects under a prefix. It lists on mount and on Refresh, and drops a row after its own delete — changes made elsewhere show up on the next refresh. Images get an inline thumbnail from a signed URL when the adapter can mint one, falling back to the gateway download proxy otherwise, so thumbnails work on every adapter.

"use client";

import { demoFiles } from "@/lib/demo-files";
import { FileList } from "@/registry/files-sdk/file-list/file-list";

const Example = () => {
  const files = demoFiles;

  return <FileList files={files} prefix="documents/" />;
};

export default Example;

Installation

npx shadcn@latest add https://files-sdk.dev/r/file-list.json

Usage

import { useFiles } from "files-sdk/react";

import { FileList } from "@/components/files-sdk/file-list";

export function Browser() {
  const files = useFiles({ endpoint: "/api/files" });

  return <FileList files={files} prefix="docs/" />;
}

Delete and download both go through the same files instance you pass in, so ambient error state stays consistent; a failed delete or download is also shown above the list. The component owns its own list state (a files.list() call on mount) — for shared, cached listing bring useList instead.

Props

PropType
filesUseFilesResult

A `useFiles()` instance — lists, downloads and deletes through it.

TypeUseFilesResult
prefix?string

Only show keys under this prefix (folder), e.g. `"docs/"`.

Typestring
endpoint?string

Gateway endpoint for the image-thumbnail fallback (its download proxy), used when the adapter can't mint a signed URL. Default `"/api/files"`.

Typestring
readOnly?boolean

Hide the delete action.

Typeboolean
onSelect?(file: StoredFile) => void

Called when a file row is clicked. Rows are inert without it.

Type(file: StoredFile) => void
onChanged?() => void

Called after a successful delete.

Type() => void
className?string
Typestring

Was this page helpful?