Omni.UI.FilesUI (Omni UI v0.1.0)

Copy Markdown View Source

Function components for the files panel.

Used internally by Omni.UI.FilesComponent to render the file list, file viewer, and panel header. Not imported by use Omni.UI.

Summary

Functions

Renders the directory listing with name, size, and updated columns.

Renders file content, dispatching on the :view assign.

Header bar for the files panel.

Preview/Code toggle for file types that support both views.

Functions

file_list(assigns)

Renders the directory listing with name, size, and updated columns.

Attributes

  • files (:map) (required)
  • error (:string) - Defaults to nil.
  • target (:any) - Defaults to nil.

file_view(assigns)

Renders file content, dispatching on the :view assign.

View modes: :iframe (HTML, PDF), :markdown (rendered Markdown), :source (syntax-highlighted text), :media (images), :download (fallback download link).

Attributes

  • file (Omni.Tools.Files.Entry) (required)
  • content (:any) - pre-rendered content for :markdown and :source views. Defaults to nil.
  • view (:atom) (required) - one of :iframe, :markdown, :source, :media, :download.
  • token (:string) (required)
  • target (:any) - Defaults to nil.

files_panel_header(assigns)

Header bar for the files panel.

Shows a back arrow when viewing a file, and slots in the source toggle, download link, and close button on the right.

Attributes

  • file (Omni.Tools.Files.Entry) - Defaults to nil.
  • view_source (:boolean) - Defaults to false.
  • token (:string) (required)
  • target (:any) - Defaults to nil.

source_toggle(assigns)

Preview/Code toggle for file types that support both views.

Attributes

  • view_source (:boolean) - Defaults to false.
  • target (:any) - Defaults to nil.