GitHub

FileViewerStates

Empty, loading, unavailable, error, and unsupported file states.

File Viewer exposes state components for custom routes and workflow-owned file surfaces. They share one visual grammar and stable data-slot attributes.

<FileViewerErrorState
  error={error}
  retry
  onRetry={reload}
  download={download}
/>

Components

ComponentUse For
FileViewerLoadingStateA file is still loading or being prepared.
FileViewerUnavailableStateThe source exists but cannot be fetched right now.
FileViewerEmptyStateNo file is selected.
FileViewerErrorStateA renderer or resource load failed.
FileViewerUnsupportedStateThe file type has no preview route.

Behavior

  • All state components accept title, description, icon, action, className, and standard div props.
  • FileViewerLoadingState renders aria-busy="true" and a default skeleton.
  • FileViewerErrorState derives user-facing copy from the error and can render retry and download actions when useful.
  • FileViewerUnsupportedState can render a download action for files that cannot be previewed.
  • The state frame uses data-slot="file-viewer-*-state" plus shared state title, description, icon, skeleton, and action slots.

Source

file-viewer.tsx