UI

File

Display one file as a media card or compact row, with file-kind glyphs, upload progress, bookmarking, and overflow actions.

import { FileCard } from '@uthereal/ui/file-card'

File card playground

, Document

PDF · 2.4 MB

Loading interactive preview…

Overview

FileCard represents one file in a library, attachment gallery, or upload queue. It renders a preview image or file-kind glyph, an opening title, a description, a byline with owner avatar and lifecycle status, an optional bookmark toggle, and an overflow menu.

Use FileCard to display stored files or active uploads. Use File input to pick or drop new files, and Action swap for interactive non-file records such as messages or tasks.

LayoutSurface structureBest for
gridVertical card with top media preview (112px default height), title, description, owner/status byline, actions.Media libraries and galleries.
rowSingle 58px compact line with a 40px glyph or thumbnail tile (hides under 300px container width) and end tools.Attachment lists and queues.

Usage

'use client'
import { FileCard } from '@uthereal/ui/file-card'

export function LibraryFile({ file, saved, saving, onSave, onRun }: Props) {
  return (
    <FileCard
      title={file.name}
      mediaType={file.type}
      description={`${file.kind} · ${file.size}`}
      meta={file.owner}
      status={file.uploading ? 'running' : undefined}
      progress={file.percent}
      statusText={file.updated}
      href={`/library/${file.id}`}
      bookmarkable
      bookmarked={saved}
      bookmarkPending={saving}
      onBookmarkedChange={onSave}
      menu={[
        {
          kind: 'action',
          id: 'download',
          label: 'Download file',
          action: 'download_file',
        },
        { kind: 'separator', id: 'danger' },
        {
          kind: 'action',
          id: 'delete',
          label: 'Delete file',
          action: 'delete_file',
          destructive: true,
        },
      ]}
      onAction={(action, entryId) => onRun(action, file.id, entryId)}
    />
  )
}

Examples

Card layout

Use layout="grid" (the default) inside a CSS grid for media galleries.

, Video

Video · 48 MB

, Archive

Archive · 12 MB

Row layout

Use layout="row" inside a vertical stack for dense file lists. When a row container narrows below 300px, the leading icon or thumbnail hides automatically.

, Document

PDF · 2.4 MB

, Archive

Archive · 12 MB

Status and loading states

Combine status, progress, reason, and loading to show queued, uploading, failed, and placeholder cards in either layout.

Notes.txt, Document

Text · 4 KB

File kinds and status

mediaType / extensionResolved FileKindDefault glyphSpoken kind (labels.kinds)
image/* (.png, .jpg, .webp, .svg)imagefile-imageImage
video/* (.mp4, .mov, .webm)videofile-playVideo
zip, tar, gzip, archive MIME typesarchivefile-archiveArchive
application/pdf, text/*, .md, .docxtextfile-textDocument
Any other MIME type or unknown extensionfilefileFile
statusVisual treatment
pendingMuted status text (Waiting).
runningStatus text (Uploading or Uploading {percent}) and a 4px spring progress bar when known.
completeSecondary status text (Ready) with a drawn check mark (success token).
errorDanger alert icon and reason (or Failed when omitted); row layout tints the outer border.

previewSrc replaces the default glyph with a decorative cover image (40px rounded thumbnail in row layout). statusText renders freeform status copy such as "Updated 2 hours ago" with word-by-word rise updates. Switch between grid and row collections using Tabs or Radio.

API reference

Serializable arguments and defaults come directly from fileCardConfigSchema.

ArgumentType / defaultDescription
titlestringDefault: "Untitled file"The file name, e.g. "Q3 report.pdf"; its extension also picks the glyph when the media type does not.
descriptionstring—A line under the title, typically the type and size ("PDF · 2.4 MB"). In the row it leads the meta line.
metastring—Who the file belongs to, in ink beside the avatar in the byline (grid).
avatarobject—The owner picture or initials (name, src) at the start of the byline (grid).
mediaTypestringDefault: "application/octet-stream"The MIME type, e.g. application/pdf. It picks one of Arc's glyphs: image, video, archive, document (PDF, text, word processing) or file; assistive technology reads the kind after the title.
previewSrcstring—A preview image URL: it fills the media in the grid and a 40 px thumbnail in the row; it is decorative, the title names the card.
hrefstring—Open the file at this URL; the title's hit area covers the card.
actionstring—A host-registered action sent when the card is opened; the title's hit area covers the card. Not with href.
statuspending | running | complete | error—Lifecycle in the byline: pending (Waiting), running (Uploading, or the percent over a bar with progress), complete (Ready, with a check) or error (an alert and the reason, or Failed without one). It rolls in when it changes and is announced. Omit it for none.
progressnumber—Percent done (0–100) while running: shown as "Uploading 42%" and a 4 px bar.
reasonstring—Why the file failed, shown after the error status (and the row border tints danger).
statusTextstring—Free status text such as "Updated 2 hours ago"; a new text rolls in word by word, as in Arc's card, and is announced.
bookmarkablebooleanDefault: falseShow a bookmark toggle; its state is host state with defaultBookmarked as the start.
defaultBookmarkedbooleanDefault: falseWhether the bookmark starts on.
menuOverflowMenuItem[]Default: []Overflow menu entries, at most 12: kind action (id, label, action, destructive) or kind separator. Actions are sent with the entry id.
layoutgrid | rowDefault: "grid"grid is Arc's card (media on top, title, description, byline and actions in the footer) for galleries; row is Arc's file row (40 px glyph or thumbnail, name and meta, actions at the end) for lists.
headingLevelintegerDefault: 3Heading level of the title, 2 to 6.
loadingbooleanDefault: falseShow a placeholder card in the same layout and announce loadingLabel.
loadingLabelstringDefault: "Loading"Announced while loading.
labelsFileCardLabels—Text: the file kind names (kinds, read after the title), the status labels with the progress template (Uploading {percent}), the bookmark toggle name (Bookmark {title}) and the overflow button name (More actions for {title}).
recipestudio | softDefault: "studio"Visual treatment. Both recipes use the same interaction behavior.
themeFileCardTheme—Color mode and accent (passed to the controls), and tokens for colors, type, the control scale, the strong hover edge and raised shadow, the panel radius, success, mediaHeight and tileSize. See Theming.
motionnone | subtle | expressiveDefault: "subtle"Hover lift and media zoom, status rolls and the progress bar. System reduced-motion preferences take precedence.
dirltr | rtl—Reading direction; the actions sit at the inline end. Omit it to inherit the page direction.

OverflowMenuItem entries are either { kind: 'action', id, label, action, destructive? } or { kind: 'separator', id }.

React integration

PropPurpose
onAction(action, entryId?)Receives the card open action (no ID) or an overflow menu action with ID.
bookmarked, onBookmarkedChangeControlled bookmark state and change callback (fires in both modes).
bookmarkPendingMarks the action group aria-busy and ignores toggle presses without blur.
renderIcon(name, { size, slot })Replaces the decorative file-kind icon (slot is 'media' or 'tile').
presetApplication defaults overridden by explicit instance props.
tokens--ui-* CSS variables forwarded to the card and all nested controls.
ref, className, style, restForwarded to the root <article> element.

Keyboard & accessibility

KeyInteraction
TabMoves between the title link/button, bookmark toggle, and overflow menu trigger.
Enter, SpaceActivates the card title action, toggles bookmarking, or opens the overflow menu.
Arrow keys, EscapeNavigates and closes the overflow menu, restoring focus to the menu button.

Each card renders an <article> with the title as a configurable heading (headingLevel, default 3). When href or action is supplied, the title's hit area covers the full card while bookmark and overflow controls sit above it on z-index: 1. Assistive technology reads the file kind after the title, and a pre-mounted role="status" region announces loading and status transitions. In right-to-left (dir="rtl") layouts, actions align to the inline end and progress bars fill from inline start. Under forced-colors: active, borders use ButtonText, progress fills use Highlight, and keyboard focus draws a Highlight outline.

Motion and theming

Hovered grid cards lift 2px on the snappy spring with a raised shadow while media zooms to 1.04; row frames strengthen their border. Status labels rise in, the progress bar slides on the smooth spring, and completion draws the check path. Under prefers-reduced-motion: reduce, hover lift, zoom, and progress-bar transforms stop while border/shadow transitions keep a 120ms fade and statusText swaps immediately. Under motion="none", all hover transforms and transitions disable immediately (0ms).

Token group / keyRole
core, controlCard surface, ink, muted byline, icon scale, and nested controls.
borderStrong, shadowRaised, popupRadiusCard corner radius (26px default) and hover/focus elevation.
success, danger, accentComplete check mark, failure state and border tint, progress fill.
mediaHeight (112), tileSize (40)grid media area height and row leading tile size in pixels.

UtherealProvider supplies application-wide defaults. See Motion.

Composition

In agent compositions, FileCard is a leaf component. Register action and every menu entry's action on the host. Bookmark state persists at /components/instance-<id>/bookmarked.

{
  "type": "FileCard",
  "props": {
    "title": "Q3 board report.pdf",
    "mediaType": "application/pdf",
    "description": "PDF · 2.4 MB",
    "meta": "Ada Park",
    "status": "complete",
    "action": "open_file"
  },
  "children": []
}

On this page