FileViewer
Auto-detecting file viewer. Accepts a FileSource (URL / base64 / bytes) and routes
to the right renderer by category: image (delegates to ImageViewer),
markdown (tabbed Preview / Source), text (highlight.js coloured),
embedded (PDF and other browser-renderable types via <iframe>),
zip (tree + nested viewer for the selected entry), and unsupported
(info message). Detection prefers the source's MIME, otherwise the file extension.
Image source
Image kinds delegate to ImageViewer with Framed + Downloadable.

Markdown source (inline bytes)
UTF-8 bytes decoded and rendered with Markdig in a Preview / Source tabbed pane.
Hello FileViewer
The FileViewer picks a renderer per file kind.
- Images flow through
ImageViewer. - Markdown picks up Markdig.
- Text/code is coloured with highlight.js.
- Zip archives expand to a tree.
var source = new FileSource.Bytes(bytes) { FileName = "readme.md" };
# Hello FileViewer
The **FileViewer** picks a renderer per file kind.
- Images flow through `ImageViewer`.
- Markdown picks up Markdig.
- Text/code is coloured with highlight.js.
- Zip archives expand to a tree.
```csharp
var source = new FileSource.Bytes(bytes) { FileName = "readme.md" };
```
Text source (inline bytes, JSON)
UTF-8 bytes rendered through highlight.js using the language inferred from the file extension.
{
"name": "ImageViewer",
"features": ["rotate", "zoom", "flip", "crop"],
"version": "1.0"
}
Unsupported
Unknown extensions fall through to a friendly message instead of throwing.
FileViewer Class
Parameters
Name | Type | Default | Description |
|---|---|---|---|
Fallback | RenderFragment? | Rendered when FileViewer.Source is null. | |
FileName | string? | File name used for category detection (extension), the embedded FileSource.FileName, otherwise to the URL's last path segment, otherwise to | |
MaxHeight | string | 60vh | Maximum height for inline renderers (text, markdown viewport, embedded iframe). Sets the scrollable region. Defaults to |
Source | FileSource? | File data to render. When null, FileViewer.Fallback is rendered instead (or nothing if no fallback is supplied). |
FallbackFileViewer.Source is null.FileNameFileSource.FileName, otherwise to the URL's last path segment, otherwise to MaxHeightSourceFileViewer.Fallback is rendered instead (or nothing if no fallback is supplied).