Klyroo.Display 0.1.0-preview.2

This is a prerelease version of Klyroo.Display.
dotnet add package Klyroo.Display --version 0.1.0-preview.2
                    
NuGet\Install-Package Klyroo.Display -Version 0.1.0-preview.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Klyroo.Display" Version="0.1.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Klyroo.Display" Version="0.1.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="Klyroo.Display" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Klyroo.Display --version 0.1.0-preview.2
                    
#r "nuget: Klyroo.Display, 0.1.0-preview.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Klyroo.Display@0.1.0-preview.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Klyroo.Display&version=0.1.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Klyroo.Display&version=0.1.0-preview.2&prerelease
                    
Install as a Cake Tool

Klyroo.Display

Rich content for Blazor: a syntax-highlighted code block, a masked secret block, a file list with a file preview overlay, and audio and video players, with a UI-free core for code highlighting, file detection and CSV parsing.

CI NuGet License: MIT

Some content needs more than markup: code that has to be colored, copied and annotated, a value that must stay masked until the user asks, a list of attachments that opens in a viewer, a clip with a play limit. Klyroo.Display ships those as distinct typed components, each with only the parameters it reads, and keeps the logic behind them in a core package with no UI dependency, so the highlighter and the file helpers also run in an API or a worker. File preview works through a service: you inject it, call Open, and a provider renders the overlay. The Blazor package targets Blazor Web Apps and declares support for .NET MAUI Blazor Hybrid platforms. The plain read-only blocks (alerts, statistics, tables, timelines and the like) are components of Klyroo.UI.

Features

  • 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

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

For native .NET MAUI apps without a BlazorWebView, the repository also includes Klyroo.Display.Maui (built from source over Klyroo.Display.Core and Klyroo.UI.Maui).

Prerequisites

To use the library in an app:

  • The .NET 11 SDK, and an app that targets net11.0. The packages are prereleases, so every dotnet add package command needs --prerelease.
  • Klyroo.Display.Core alone (code highlighting, file kinds, CSV parsing, sizes) runs in any .NET 11 app.
  • A Blazor app for Klyroo.Display: a Blazor Web App or a .NET MAUI Blazor Hybrid app. The code, secret and file list blocks render in static server rendering; the media players, copy buttons, the Reveal toggle, Show more and the file preview need an interactive render mode. In a WebAssembly or Auto app, register the services in the server project and in the .Client project.
  • Klyroo.UI set up in the app. Klyroo.Display brings the Klyroo.UI package, and AddKlyrooDisplay() registers its services, but the layout still needs the Klyroo.UI stylesheets in <head> and <KlyApp> around the body, as described in the Klyroo.UI installation.
  • <KlyFilePreviewProvider> in the layout to open file previews, and a secure context (HTTPS or localhost) for the copy buttons, which use the clipboard API.
  • A browser with the native popover API, which Klyroo.UI uses: Chrome and Edge 114, Safari 17 or Firefox 125, or later. In a .NET MAUI app, that means iOS or Mac Catalyst 17, or an Android System WebView 114 or later.
  • Network access on the first build only if your app self-hosts web fonts (KlyrooFont), uses icons outside the built-in set, or compiles Tailwind (KlyrooTailwind): the build downloads them once and caches them under obj/klyroo. Node.js is not needed.

To build this repository you need the .NET 11 SDK (a newer SDK works too, see global.json) and a clone of klyroo-ui in the same parent folder: some projects reference it by relative path (../klyroo-ui/...). See Contributing.

Installation

dotnet add package Klyroo.Display --prerelease

For code that has no UI, such as an API or a worker, install only the core:

dotnet add package Klyroo.Display.Core --prerelease

Register the services in Program.cs, and in the client project too when you use WebAssembly or Auto:

using Klyroo.Display;

builder.Services.AddKlyrooDisplay();

Import the namespaces in _Imports.razor:

@using Klyroo.UI
@using Klyroo.Display

Load the stylesheets in App.razor, inside <head>. klyroo-display.css is the compiled Tailwind classes the components use:

<link rel="stylesheet" href="@Assets["_content/Klyroo.UI/klyroo.preflight.css"]" />
<link rel="stylesheet" href="@Assets["_content/Klyroo.UI/klyroo.css"]" />
<link rel="stylesheet" href="@Assets["_content/Klyroo.Display/klyroo-display.css"]" />

Quick start

Headless, with Klyroo.Display.Core:

using Klyroo.Display;

var csv = FilePreviewService.ParseCsv("Item;Price\nDesk;299.90\nChair;149.00", "catalog.csv");
Console.WriteLine($"{csv.Rows.Count} rows, delimiter '{csv.Delimiter}', price column numeric: {csv.NumericColumns[1]}");

Console.WriteLine(FilePreviewService.DetectKind("report.pdf"));      // Pdf
Console.WriteLine(FilePreviewService.FormatFileSize(1_572_864));     // 1.5 MB

var language = CodeHighlighter.ResolveFileName("Program.cs");        // CodeLanguage.CSharp
Console.WriteLine(CodeHighlighter.Highlight("var n = 42;", language!.Value));
// <span data-token="keyword">var</span> n <span data-token="punctuation">=</span> <span data-token="number">42</span><span data-token="punctuation">;</span>

In a Blazor page:

<KlyCodeBlock Code="@Snippet" Language="CodeLanguage.Sql" Label="Query" LineNumbers
              HighlightLines="@([2, new CodeLineRange(4, 5)])" />

<KlySecretBlock Label="API key" Value="sk_test_9876543210" />

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

@code {
    private const string Snippet = "SELECT id, total\nFROM orders\nWHERE status = 'paid'\n  AND total > 100\nORDER BY total DESC;\n";

    private readonly IReadOnlyList<FileListItem> _files =
    [
        new FilePreviewFile { Src = "/files/spec.pdf", Size = 1_572_864 },
        new FileListItem(new FilePreviewFile { Src = "/files/metrics.csv", Size = 18_400 }, Description: "March export"),
    ];
}

To preview files, add <KlyFilePreviewProvider /> once to an interactive layout, inject FilePreviewService where you need it and call Open. Getting started builds that end to end.

Documentation

Getting started Step-by-step first integration
Guides Task-oriented recipes
Concepts How the library works
Platforms Render modes, .NET MAUI, NativeAOT
API reference Every public type and member
FAQ Troubleshooting and limitations

Compatibility

  • .NET 11 SDK.
  • Klyroo.Display.Core runs anywhere .NET 11 runs and is marked IsAotCompatible and IsTrimmable.
  • Klyroo.Display renders in Interactive Server, WebAssembly, Auto and static server rendering. Copy buttons, the Reveal toggle, Show more, the player controls and the file preview overlay need an interactive render mode.
  • Klyroo.Display declares browser, ios, android, maccatalyst and windows as supported platforms for .NET MAUI Blazor Hybrid. It is marked IsTrimmable but not IsAotCompatible.
  • Klyroo.Display depends on Klyroo.UI for theming and the base components.

Klyroo ecosystem

Klyroo is a family of independent .NET libraries that compose. Each one has its own repository, versions and releases.

Library Description
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

Contributing

Contributions are welcome. Read CONTRIBUTING.md before opening a pull request, and follow the code of conduct. Report security issues privately as described in SECURITY.md.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Klyroo.Display:

Package Downloads
Klyroo.Stack

Umbrella meta-package for the entire Klyroo ecosystem (UI, Query, Table, Form, Dashboard, Display, Spreadsheet, Agent) for Blazor Web and .NET MAUI Hybrid.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-preview.2 35 11/29/2026
0.1.0-preview.1 37 11/29/2026