BlazorSBOMViewer 1.0.4
dotnet add package BlazorSBOMViewer --version 1.0.4
NuGet\Install-Package BlazorSBOMViewer -Version 1.0.4
<PackageReference Include="BlazorSBOMViewer" Version="1.0.4" />
<PackageVersion Include="BlazorSBOMViewer" Version="1.0.4" />
<PackageReference Include="BlazorSBOMViewer" />
paket add BlazorSBOMViewer --version 1.0.4
#r "nuget: BlazorSBOMViewer, 1.0.4"
#:package BlazorSBOMViewer@1.0.4
#addin nuget:?package=BlazorSBOMViewer&version=1.0.4
#tool nuget:?package=BlazorSBOMViewer&version=1.0.4
BlazorSBOMViewer
A powerful, customizable Blazor component library for visualizing Software Bill of Materials (SBOM) in CycloneDX, SPDX 2.x, and SPDX 3.0 formats.
Built on MudBlazor, it provides a clean, searchable interface for packages, files, licenses, vulnerabilities, and relationships.
Features
- Multi-Format Support:
- CycloneDX: JSON, XML, Protobuf
- SPDX 2.x: JSON, Tag-Value, XML, YAML, RDF/XML
- SPDX 3.0: JSON-LD
- Unified Entry Point: One component (
SbomViewer) handles all formats with automatic detection. - Rich Visualization:
- Metadata cards with creation info and timestamps.
- Searchable tables for Components, Files, and Vulnerabilities.
- Relationship graph views (tabular representation).
- License expressions and URLs.
- Flexible Input: Load from file path, raw bytes, or pre-parsed document models.
- Themeable: Inherits your MudBlazor theme settings.
- Cross-Platform: Works in Blazor Server, WebAssembly, and MAUI Hybrid.
Installation
dotnet add package BlazorSBOMViewer
Note: BlazorSBOMViewer requires MudBlazor.
Setup
- Register services in your
Program.csorMauiProgram.cs:
using BlazorSBOMViewer.Extensions;
using MudBlazor.Services;
// ...
builder.Services.AddMudServices();
builder.Services.AddBlazorSBOMViewer();
- Add MudBlazor resources to your HTML host (e.g.,
App.razor,index.html, or_Host.cshtml):
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet" />
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet" />
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
- Ensure
MudThemeProviderand other providers are in yourMainLayout.razor:
<MudThemeProvider />
<MudPopoverProvider />
<MudDialogProvider />
<MudSnackbarProvider />
Usage
Import the component and model namespaces once in your page or _Imports.razor:
@using BlazorSBOMViewer.Components
@using BlazorSBOMViewer.Models
Simple Usage (Auto-Detection)
<SbomViewer RawBytes="@mySbomBytes" DownloadFileName="my-app-sbom" />
From File Path (Blazor Server / MAUI)
<SbomViewer FilePath="/path/to/sbom.spdx.json" />
With Pre-Parsed Document
<SbomViewer CycloneDxDocument="@myParsedCdxDoc" />
With Source Format Override
Use SourceFormatOverride when the input is non-JSON or when you want deterministic parsing instead of auto-detection:
<SbomViewer RawBytes="@xmlBytes"
SourceFormatOverride="SbomSourceDocumentFormat.SpdxXml"
DownloadFileName="sbom-from-xml" />
Customizing the UI
<SbomViewer RawBytes="@bytes"
DownloadFileName="my-app-1.0"
DisplayOptions="@(new SbomDisplayOptions {
ShowVulnerabilitiesTab = false,
ShowRelationshipsTab = false,
EnableDownloads = false,
DefaultPageSize = 50
})" />
Custom Error Display
Supply a RenderFragment<string> to ErrorContent to replace the default error alert:
<SbomViewer RawBytes="@bytes">
<ErrorContent Context="msg">
<MudAlert Severity="Severity.Warning">Could not load SBOM: @msg</MudAlert>
</ErrorContent>
</SbomViewer>
Using Parsers Directly
The parsers are registered in DI by AddBlazorSBOMViewer() and can be injected anywhere — no Blazor component required. They return strongly-typed document objects that can be used independently of the viewer.
Namespaces
using BlazorSBOMViewer.Services; // CycloneDxParser, SpdxParser
using BlazorSBOMViewer.Services.Spdx3; // Spdx3Parser
using BlazorSBOMViewer.Models.CycloneDx; // CycloneDxBomDocument
using BlazorSBOMViewer.Models.Spdx; // SpdxDocument
using BlazorSBOMViewer.Models.Spdx3; // Spdx3Document
Inject and Parse
// Blazor component or service
@inject CycloneDxParser CycloneDxParser
@inject SpdxParser SpdxParser
@inject Spdx3Parser Spdx3Parser
// From raw bytes (format auto-detected)
CycloneDxBomDocument cdx = CycloneDxParser.Parse(fileBytes);
SpdxDocument spdx = SpdxParser.Parse(fileBytes);
Spdx3Document spdx3 = Spdx3Parser.Parse(fileBytes);
// From a string
CycloneDxBomDocument cdx = CycloneDxParser.Parse(jsonString);
SpdxDocument spdx = SpdxParser.Parse(tagValueString);
// From a file path (server-side only)
CycloneDxBomDocument cdx = CycloneDxParser.ParseFile("/path/to/bom.cdx.json");
SpdxDocument spdx = SpdxParser.ParseFile("/path/to/sbom.spdx");
Spdx3Document spdx3 = Spdx3Parser.ParseFile("/path/to/sbom.spdx3.json");
// From a stream
await using var stream = File.OpenRead("/path/to/bom.cdx.xml");
CycloneDxBomDocument cdx = CycloneDxParser.Parse(stream);
Force a Specific Format
Pass an optional format enum to skip auto-detection:
// CycloneDxDocumentFormat: Json | Xml | Protobuf
CycloneDxBomDocument cdx = CycloneDxParser.Parse(bytes, CycloneDxDocumentFormat.Xml);
// SpdxDocumentFormat: Json | TagValue | Xml | Yaml | Rdf
SpdxDocument spdx = SpdxParser.Parse(bytes, SpdxDocumentFormat.Yaml);
Parser API Summary
| Parser | Return Type | Overloads |
|---|---|---|
CycloneDxParser |
CycloneDxBomDocument |
Parse(string), Parse(byte[]), Parse(Stream), ParseFile(string), DetectFormat(string/byte[]) |
SpdxParser |
SpdxDocument |
Parse(string), Parse(byte[]), Parse(Stream), ParseFile(string), DetectFormat(string) |
Spdx3Parser |
Spdx3Document |
Parse(string), Parse(byte[]), Parse(Stream), ParseFile(string), IsSpdx3(byte[]) |
Example: Pipeline Without UI
// In a background service, API endpoint, or test
public class SbomAuditService(CycloneDxParser parser)
{
public IEnumerable<string> GetLicenses(byte[] sbomBytes)
{
var doc = parser.Parse(sbomBytes);
return doc.Components
.SelectMany(c => c.Licenses)
.Select(l => l.License?.Id ?? l.License?.Name ?? l.Expression)
.Where(l => l is not null)
.Distinct()!;
}
}
Component Reference
SbomViewer Parameters
Input
| Parameter | Type | Description |
|---|---|---|
RawBytes |
byte[]? |
Raw file bytes — format is auto-detected |
FilePath |
string? |
Absolute path to an SBOM file on the server (Blazor Server / MAUI only) |
CycloneDxDocument |
CycloneDxBomDocument? |
Pre-parsed CycloneDX document (skips auto-detection) |
SpdxDocument |
SpdxDocument? |
Pre-parsed SPDX 2.x document |
Spdx3Document |
Spdx3Document? |
Pre-parsed SPDX 3.0 document |
Priority order when multiple inputs are set: pre-parsed documents → RawBytes → FilePath.
Format Control
| Parameter | Type | Description |
|---|---|---|
SourceFormatOverride |
SbomSourceDocumentFormat? |
Force a specific parser instead of auto-detecting |
SbomSourceDocumentFormat values: CycloneDxJson, CycloneDxXml, CycloneDxProtobuf, SpdxJson, SpdxTagValue, SpdxXml, SpdxYaml, SpdxRdf, Spdx3JsonLd.
UI & Behaviour
| Parameter | Type | Default | Description |
|---|---|---|---|
DisplayOptions |
SbomDisplayOptions? |
All enabled | Controls tab visibility, search, downloads, and page size |
DownloadFileName |
string? |
"sbom" |
Base filename (no extension) for downloaded files |
ErrorContent |
RenderFragment<string>? |
Built-in alert | Custom Razor template for errors; receives the error message |
SbomDisplayOptions Properties
| Property | Type | Default | Effect |
|---|---|---|---|
ShowOverviewTab |
bool |
true |
Show/hide the Overview tab |
ShowComponentsTab |
bool |
true |
Show/hide the Components tab |
ShowFilesTab |
bool |
true |
Show/hide the Files tab |
ShowLicensesTab |
bool |
true |
Show/hide the Licenses tab |
ShowVulnerabilitiesTab |
bool |
true |
Show/hide the Vulnerabilities tab |
ShowRelationshipsTab |
bool |
true |
Show/hide the Relationships tab |
EnableSearch |
bool |
true |
Enable/disable the search box in tables |
EnableDownloads |
bool |
true |
Show/hide the download button |
DefaultPageSize |
int |
25 |
Rows per page in component/file tables |
Download Formats
When downloads are enabled, the button offers formats matching the source document type:
| Source | Available Download Formats |
|---|---|
| CycloneDX | JSON (.cdx.json), XML (.cdx.xml), Protobuf (.cdx.pb) |
| SPDX 2.x | JSON (.spdx.json), Tag-Value (.spdx), XML (.spdx.xml), YAML (.spdx.yaml), RDF/XML (.spdx.rdf) |
| SPDX 3.0 | JSON-LD (.spdx3.json) |
Supported Formats
| Family | Formats | Auto-Detect |
|---|---|---|
| CycloneDX | JSON, XML, Protobuf | Yes |
| SPDX 2.x | JSON, Tag-Value, XML, YAML, RDF/XML | Yes |
| SPDX 3.0 | JSON-LD | Yes |
Limitations
- No Conversion: The library visualizes SBOMs but does not automatically convert between format families (e.g., converting CycloneDX to SPDX).
- MudBlazor Dependency: UI components are tightly integrated with MudBlazor.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. |
-
net10.0
- CycloneDX.Core (>= 12.0.1)
- MudBlazor (>= 9.1.0)
- YamlDotNet (>= 17.0.1)
-
net8.0
- CycloneDX.Core (>= 12.0.1)
- MudBlazor (>= 9.1.0)
- YamlDotNet (>= 17.0.1)
-
net9.0
- CycloneDX.Core (>= 12.0.1)
- MudBlazor (>= 9.1.0)
- YamlDotNet (>= 17.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.