Skip to content

Code, filesand media.

Highlight code in thirteen languages with line numbers and emphasized lines, mask a secret until it is revealed, and open PDFs, images, video, audio, CSV, Markdown and text in a file preview overlay, next to audio and video players with clip and play-limit rules.

Install dotnet add package Klyroo.Display --prerelease
The Klyroo.Display line and its 4 stations
Klyroo.Display
  1. Players
  2. Code
  3. Secrets
  4. Preview
KlyrooStack Klyroo.Stack, the interchange of the network
Order.razor 9 lines
Order.razor
<KlyCodeBlock Label="Orders.sql" Code="@Query"
    Language="CodeLanguage.Sql" LineNumbers
    HighlightLines="@([2, new CodeLineRange(4, 5)])" />

<KlySecretBlock Label="API key" Value="@ApiKey"
    VisibleChars="4" />

<KlyFileList Title="Attachments" Files="_files" />
<KlyFilePreviewProvider />

KlyCodeBlock colors the code from its Language and keeps the text plain, so selecting and copying give the code as it is.

Code block sample data
SELECT id, totalFROM ordersWHERE status = 'paid'  AND total > 100  AND shipped_at IS NULL;

colored from Language by the CodeHighlighter of Klyroo.Display.Core, 13 languages line 2 and lines 4 to 5 are emphasized; the numbers are drawn with CSS, so copying gives the code only

Secret and files sample data
API key ••••••••3210 Reveal
  • PDFSpecification.pdfVersion 3 · 1.5 MBUpdated today
  • CSVmetrics.csv18 KB
  • PDFQ3 summary

eight bullets, then the last four characters; the copy button copies the whole value each row shows a badge, the name, the size and a description a click opens all the files as a gallery in the preview, starting at the clicked one

Everything it does

Syntax highlighting
KlyCodeBlock colors C#, JavaScript, TypeScript, JSON, HTML, XML, CSS, SCSS, Less, SQL, Python, Bash and YAML from a typed CodeLanguage, with a label, a copy button, optional line numbers and emphasized lines (HighlightLines), and the file preview does the same from the file extension. The scanner is CodeHighlighter in Klyroo.Display.Core: dependency-free, trim and AOT safe, it never throws, and CodeHighlighter.Highlight(code, language) returns escaped markup for pages that Blazor does not render.
Secret values
KlySecretBlock masks all but the last characters of a value, with a Reveal toggle and a copy button, and never highlights it.
File list and preview overlay
KlyFileList lists files (FileListItem: a FilePreviewFile with an optional description, meta text, icon and tone) with an extension badge, a size and a date, and a click opens them as a gallery in the overlay. KlyFilePreviewProvider shows PDF, images, video, audio, CSV, Markdown and text in a modal, drawer or fullscreen panel, with keyboard navigation, image zoom and rotation, a details panel and downloads.
Headless file helpers
Klyroo.Display.Core detects a file kind from its MIME type or extension, parses CSV and TSV (RFC 4180 quoting, delimiter detection) and formats sizes, and it is NativeAOT compatible.
Audio and video players with clip and play-limit rules
KlyAudioPlayer and KlyVideoPlayer play a clip window of a file, enforce a play quota and a non-seekable timeline, and report progress and the end of each play through callbacks. Their control bar has volume, speed, captions, picture-in-picture and fullscreen controls, and a compact size.
Themeable like Klyroo.UI
Each block has slots with default classes (KlyrooDisplayOptions.CodeBlock, SecretBlock and FileList) that you extend in AddKlyrooDisplay, and a typed Ui parameter (CodeBlockUi, SecretBlockUi, FileListUi) for one instance.
Translated texts
The built-in labels follow the Klyroo.UI locale, with a DisplayTexts set for each of its twelve languages (English and French reviewed), and AddKlyrooDisplay(d => d.Texts("fr", t => t with { ... })) changes any of them.

Packages

  • CodeHighlighter and CodeLanguage, FilePreviewService, file kind detection, CSV parser and the file and media models. No UI dependency.
  • KlyCodeBlock, KlySecretBlock, KlyFileList, KlyAudioPlayer, KlyVideoPlayer and KlyFilePreviewProvider for Blazor. Builds on Klyroo.UI and includes the Core package.

Install it, then open the first page.

Change here for the other lines

  • Klyroo.UI Accessible Blazor components for the web and .NET MAUI Blazor Hybrid, styled with Tailwind CSS v4
  • Klyroo.Query Typed query model, URL state sync, and IQueryable / EF Core execution
  • Klyroo.Table Data lists with table and card-grid layouts, filters, selection and actions
  • Klyroo.Form Schema-driven forms, validation and wizards
  • Klyroo.Dashboard Dashboard controller, filters and Blazor blocks: stats, gauges, charts, tables and feeds
  • Klyroo.Display Code highlighting, file preview and audio and video players
  • Klyroo.Spreadsheet Import wizard for CSV, TSV and pasted data, with column and value mapping
  • Klyroo.Agent Bridge that lets AI agents read and act on Klyroo forms, dashboards and imports
  • Klyroo.Hotkey Server-side .NET client for Hotkey cloud browsers, human handoffs and signed webhooks
  • Klyroo.Stack Meta-package, MCP documentation server and dotnet new templates