Files an agent made or fetched, as cards in a conversation or a task's list.
import type { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { FileList } from "./ui/uicontext/components/kit/FileList.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { color, radius } from "./ui/uicontext/components/tokens.stylex.ts"const styles = stylex.create({ panel: { width: "min(100%, 26rem)", padding: 6, borderRadius: radius.lg, borderWidth: 1, borderStyle: "solid", borderColor: color.line } })export const TaskFiles = <M>(h: Html.H<M>) => h.div.attrs(sx(styles.panel)).children(FileList(h, { label: "Files", locale: "en-US", files: [ { id: "csv", name: "operating-november.csv", size: 12_800, source: "Downloaded from the bank", href: "#csv" }, { id: "remit", name: "remittance-4410.pdf", size: 98_304, source: "From Priya Anand's email", href: "#remit" }, { id: "deck", name: "Q3 Board Deck — FINAL (revised) v12 [approved by legal].pdf", size: 8_400_000, detail: "31 pages", source: "Made from the ledger", href: "#deck" }, { id: "photo", name: "IMG_20250914_183022_HDR_portrait_edited_edited.HEIC", size: 3_100_000, source: "From your phone" }, ], }))Installation
pnpm dlx shadcn@latest add checkfu/uicontext/file-listUsage
import { FileCard, FileList } from "./ui/uicontext/components/kit/FileList.ts"export const Files = <M>(h: Html.H<M>) => [ FileCard(h, { file: { id: "agenda", name: "Kickoff agenda.pdf", size: 1_240_000, detail: "12 pages", href: "/files/agenda.pdf" } }), FileList(h, { label: "Files", files: [{ id: "remit", name: "remittance-4410.pdf", size: 98_304, source: "From Priya Anand's email", href: "/files/remittance-4410.pdf" }], empty: "Files the assistant downloads or makes show up here.", }),]Examples
Attachment cards
A file in a conversation: kind, name, what's in it and its size, and a download. Without a link there's nothing to press.
import type { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { FileCard } from "./ui/uicontext/components/kit/FileList.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { space } from "./ui/uicontext/components/tokens.stylex.ts"const styles = stylex.create({ column: { display: "flex", flexDirection: "column", gap: space.sm } })export const Cards = <M>(h: Html.H<M>) => h.div.attrs(sx(styles.column)).children( FileCard(h, { file: { id: "a", name: "Halcyon kickoff agenda.pdf", size: 1_240_000, detail: "12 pages", href: "#a" } }), FileCard(h, { file: { id: "b", name: "Invoices due Friday.csv", size: 4_200, href: "#b" } }), FileCard(h, { file: { id: "c", name: "2026-11-30.md", size: 4_700, detail: "Draft" } }), )API reference
FileCardView function
Options
| Name | Type | Description |
|---|---|---|
filerequired | FileItem | — |
locale | string | — |
style | Style | — |
FileListView function
Options
| Name | Type | Description |
|---|---|---|
labelrequired | string | — |
filesrequired | FileItem[] | — |
empty | string | Shown with no files: what will appear here |
locale | string | — |