The file an agent made, as a card in the chat: a tile with the file's kind, the name, size, pages and where it was saved, a thin bar while it is still being written, an error with Try again, and Open and Download.
Used for
- Generated report in chat
- Export ready to download
- File still being written
- Failed export with retry
Examples
Installation
npx knowns-ui@latest add file-resultFor Claude Code, Cursor or Codex: installs it and wires the props to your own data.
Paste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install prompt
Install File result from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/file-result
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add file-result
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/use-floating.ts
- components/ui/knowns/tooltip.tsx
- components/ui/knowns/tooltip-utils.ts
- components/ui/knowns/progress.tsx
- components/ui/knowns/file-result/file-result.tsx
- components/ui/knowns/file-result/file-result-utils.ts
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0, class-variance-authority@^0.7.1.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/file-result, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "file-result" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Props
- name
string- File name with its extension. The tile's label and tint come from it.
- kind
"pdf"|"sheet"|"doc"|"slides"|"image"|"archive"|"code"|"text"|"file"- Default
from the name - Override the kind.
- size
number- Bytes, shown as 184 KB (1 KB is 1000 bytes).
- meta / location
ReactNode- More facts after the size: 2 pages / saved to Documents.
- status
"generating"|"ready"|"error"- Default
"ready" - Generating shows a thin bar along the bottom and holds Open and Download back.
- progress / progressLabel
number / ReactNode- Default
- / "Writing the file" - 0 to 1 while generating; without it the bar runs open-ended.
- error / onRetry
ReactNode / () => void- With status error: what went wrong, and Try again.
- href / onOpen
string / () => void- Open as a link or a button.
- downloadHref / onDownload
string / () => void- Download as a link with the download attribute, or a button.
- preview
ReactNode- A first-page thumbnail instead of the kind tile, 40 by 48.
| Prop | Type | Default | Description |
|---|---|---|---|
| name | string | - | File name with its extension. The tile's label and tint come from it. |
| kind | "pdf" | "sheet" | "doc" | "slides" | "image" | "archive" | "code" | "text" | "file" | from the name | Override the kind. |
| size | number | - | Bytes, shown as 184 KB (1 KB is 1000 bytes). |
| meta / location | ReactNode | - | More facts after the size: 2 pages / saved to Documents. |
| status | "generating" | "ready" | "error" | "ready" | Generating shows a thin bar along the bottom and holds Open and Download back. |
| progress / progressLabel | number / ReactNode | - / "Writing the file" | 0 to 1 while generating; without it the bar runs open-ended. |
| error / onRetry | ReactNode / () => void | - | With status error: what went wrong, and Try again. |
| href / onOpen | string / () => void | - | Open as a link or a button. |
| downloadHref / onDownload | string / () => void | - | Download as a link with the download attribute, or a button. |
| preview | ReactNode | - | A first-page thumbnail instead of the kind tile, 40 by 48. |
Accessibility
- The card is a group named "File: name", so the actions after it are heard in context.
- While generating it is aria-busy and the bar is a named progressbar; the error line is an alert.
- Download is an icon button named "Download name". The kind tile is decorative: the extension is in the name.
What it handles
- 01Shows a tile with the file's extension, tinted by kind: PDF red, sheets green, docs blue, slides amber, images pink.
- 02Lists the name, the size in KB or MB, more facts such as pages or rows, and where it was saved.
- 03Runs a thin bar along the bottom while the file is written, with a percent when you give the progress.
- 04Holds Open and Download back until it is ready, then shows them as links or buttons.
- 05Shows what went wrong with Try again when it fails.
- 06Takes a first-page preview instead of the tile.
States
- First render
- The card as it is; nothing moves
- none
- Generating
- The bar fills or runs open-ended
- none
- Ready
- Open and Download appear
- none
| State | What moves | Timing |
|---|---|---|
| First render | The card as it is; nothing moves | none |
| Generating | The bar fills or runs open-ended | none |
| Ready | Open and Download appear | none |
Works with
When to use
When to use
- The file an agent wrote in a chat turn (a brief, an export, a deck), with Open and Download once it is ready.
- A file that is still being made, or one that failed, with Try again.
When not to use
- Files the person attaches to a message: use Chat Composer.
- A whole folder of files to browse: use Media Library.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI File Result to my app and wire it to my own data.
- I need the file an agent wrote in a chat turn (a brief, an export, a deck), with Open and Download once it is ready. Set that up with the Knowns UI File Result.
- Which File Result props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "file-result" }) and search_docs({ query: "file result" }).