GcdsWrapper.Blazor 0.3.1

dotnet add package GcdsWrapper.Blazor --version 0.3.1
                    
NuGet\Install-Package GcdsWrapper.Blazor -Version 0.3.1
                    
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="GcdsWrapper.Blazor" Version="0.3.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GcdsWrapper.Blazor" Version="0.3.1" />
                    
Directory.Packages.props
<PackageReference Include="GcdsWrapper.Blazor" />
                    
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 GcdsWrapper.Blazor --version 0.3.1
                    
#r "nuget: GcdsWrapper.Blazor, 0.3.1"
                    
#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 GcdsWrapper.Blazor@0.3.1
                    
#: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=GcdsWrapper.Blazor&version=0.3.1
                    
Install as a Cake Addin
#tool nuget:?package=GcdsWrapper.Blazor&version=0.3.1
                    
Install as a Cake Tool

GCDS Wrapper for Blazor

Main package NuGet Version Main package NuGet Downloads Main package GitHub Actions Workflow Status

Thin, idiomatic Blazor wrappers for the official GC Design System (GCDS) components. The library maps Razor parameters and events to the upstream web components; it does not reimplement their markup or styles.

This version targets .NET 10 and pins @gcds-core/components 1.7.1.

The repository also contains GcdsWrapper.Blazor.Markdown, an independently versioned package that renders Markdown using these wrappers and accessible semantic HTML.

What is included

  • A Blazor component for every custom element in the pinned GCDS release
  • Typed parameters for commonly used GCDS attributes, with unmatched attributes passed through
  • EditForm integration, two-way binding, and validation for GCDS form controls
  • Blazor callbacks for GCDS custom events
  • Automatic, idempotent loading of the pinned GCDS stylesheet and JavaScript module
  • A bilingual interactive documentation site in GcdsWrapper.Demo

Available wrappers include:

GcdsAlert, GcdsBreadcrumbs, GcdsBreadcrumbsItem, GcdsButton, GcdsCard, GcdsCheckboxes, GcdsContainer, GcdsDateInput, GcdsDateModified, GcdsDetails, GcdsErrorMessage, GcdsErrorSummary, GcdsFieldset, GcdsFileUploader, GcdsFooter, GcdsGrid, GcdsGridCol, GcdsHeader, GcdsHeading, GcdsHint, GcdsIcon, GcdsInput, GcdsLabel, GcdsLangToggle, GcdsLink, GcdsNavGroup, GcdsNavLink, GcdsNotice, GcdsPagination, GcdsRadios, GcdsSearch, GcdsSelect, GcdsSideNav, GcdsSignature, GcdsSrOnly, GcdsStepper, GcdsTable, GcdsText, GcdsTextarea, GcdsTopNav, and GcdsTopicMenu.

Installation

Install the package from NuGet:

dotnet add YourApp/YourApp.csproj package GcdsWrapper.Blazor

When developing against this repository, reference the library project directly instead:

dotnet add YourApp/YourApp.csproj reference GcdsWrapper.Blazor/GcdsWrapper.Blazor.csproj

Add the namespace to your app's _Imports.razor:

@using GcdsWrapper.Blazor

Render GcdsAssets once near the root of the app, such as in App.razor:

<GcdsAssets />

GcdsAssets loads the official stylesheet and ES module from the GCDS CDN. Loading is idempotent, so duplicate instances do not add duplicate assets.

Basic usage

Component parameters use PascalCase and are emitted as the corresponding kebab-case GCDS attributes. For example, CardTitleTag becomes card-title-tag.

<GcdsAlert Heading="Service update" AlertRole="info">
    Scheduled maintenance begins at 8 p.m.
</GcdsAlert>

<GcdsCard CardTitle="GC application guide"
          CardTitleTag="h2"
          Href="/guide"
          Description="Learn how to submit an application.">
    <span slot="title"><abbr title="Government of Canada">GC</abbr> application guide</span>
</GcdsCard>

<GcdsBreadcrumbs>
    <GcdsBreadcrumbsItem Href="/">Home</GcdsBreadcrumbsItem>
    <GcdsBreadcrumbsItem Href="/services">Services</GcdsBreadcrumbsItem>
</GcdsBreadcrumbs>

Use AdditionalAttributes for native attributes or upstream GCDS attributes that do not yet have a typed parameter. Named slots can be supplied as child markup. The card's title slot accepts rich content while CardTitle provides its text fallback.

Forms and validation

The form wrappers derive from Blazor's InputBase<TValue>, so they support @bind-Value, EditContext field notifications, data-annotation validation, and GCDS validation events.

  • GcdsInput, GcdsSelect, GcdsTextarea, GcdsRadios, GcdsDateInput, and GcdsSearch bind to string?.
  • GcdsCheckboxes and GcdsFileUploader bind to string[]?.

GcdsDateInput.Autocomplete supports the upstream on, off, bday, and cc-exp values.

<EditForm Model="model" OnValidSubmit="Save">
    <DataAnnotationsValidator />

    <GcdsInput Id="email"
               Name="email"
               Label="Email address"
               Type="GcdsInputType.Email"
               Required
               @bind-Value="model.Email" />

    <GcdsSelect Id="province"
                Name="province"
                Label="Province"
                DefaultValue="Select a province"
                @bind-Value="model.Province">
        <option value="on">Ontario</option>
        <option value="qc">Quebec</option>
    </GcdsSelect>

    <GcdsTextarea Id="summary"
                  Name="summary"
                  Label="Summary"
                  Required
                  @bind-Value="model.Summary" />

    <GcdsDateInput Name="birth-date"
                   Legend="Birth date"
                   Autocomplete="bday"
                   @bind-Value="model.BirthDate" />

    <GcdsButton Type="GcdsButtonType.Submit">Save</GcdsButton>
</EditForm>

Checkbox, radio, and autocomplete data can be supplied with GcdsCheckboxOption, GcdsRadioOption, and GcdsSuggestionOption. Structured properties such as options, table columns, and table data also accept the JSON string supported by GCDS or a serializable .NET object.

Events

Wrappers expose supported custom events as Blazor callbacks, including OnBlur, OnChange, OnClick, OnDismiss, OnFocus, OnInput, OnRemoveFile, OnSubmit, OnTableStateChange, and validation callbacks. General wrapper events use GcdsEventArgs, whose detail can be deserialized to a .NET type.

<GcdsAlert Heading="Saved" OnDismiss="HandleDismiss">
    Changes saved.
</GcdsAlert>

@code {
    private void HandleDismiss(GcdsEventArgs args)
    {
        // args.Name is "gcdsDismiss".
        // Use args.GetDetail<T>() when the event includes detail.
    }
}

Form wrappers provide strongly typed value callbacks where applicable, such as OnInput, OnChange, OnSubmit, and OnSuggestionSelected.

Interactive documentation

Run the bilingual WebAssembly documentation site:

dotnet run --project GcdsWrapper.Demo/GcdsWrapper.Demo.csproj

Open /en/components or /fr/composants. Each component page provides a live example, Razor usage, reflected parameter metadata, supported events, and a link to the matching official GCDS guidance.

The Markdown package is documented at /en/markdown and /fr/markdown.

Markdown package

Markdown package NuGet Version Markdown package NuGet Downloads Markdown package GitHub Actions Workflow Status

Install the optional Markdown renderer separately:

dotnet add YourApp/YourApp.csproj package GcdsWrapper.Blazor.Markdown

Add @using GcdsWrapper.Blazor.Markdown to _Imports.razor, continue rendering <GcdsAssets /> once, and pass Markdown text to the component:

<GcdsMarkdown Value="@markdown" HeadingLevelOffset="1" />

@code {
    private const string markdown = """
        # Service guide

        Read the **application instructions** before [starting](/apply).
        """;
}

Raw HTML is ignored unless AllowHtml is explicitly enabled. Enabled HTML is not sanitized and must only come from a completely trusted source.

Development

dotnet restore GcdsWrapper.Blazor/GcdsWrapper.Blazor.csproj
dotnet build GcdsWrapper.Blazor/GcdsWrapper.Blazor.csproj
dotnet test --project GcdsWrapper.Blazor.Tests/GcdsWrapper.Blazor.Tests.csproj
dotnet test --project GcdsWrapper.Blazor.Markdown.Tests/GcdsWrapper.Blazor.Markdown.Tests.csproj
dotnet format GcdsWrapper.Blazor/GcdsWrapper.Blazor.csproj --verify-no-changes

To create and verify the release packages:

dotnet pack GcdsWrapper.Blazor/GcdsWrapper.Blazor.csproj -c Release -o artifacts

Releasing

Releases are created automatically when a supported semantic version tag is pushed. Update the <Version> in GcdsWrapper.Blazor/GcdsWrapper.Blazor.csproj, commit that change, then create and push an exactly matching tag:

git tag v0.1.1
git push origin v0.1.1

The release workflow tests and verifies the package before publishing it to NuGet.org. After publication succeeds, it creates a GitHub Release with generated release notes and attaches the .nupkg and .snupkg files. Tags with a prerelease suffix, such as v0.2.0-beta.1, publish prerelease packages and are marked as prereleases on GitHub.

Markdown releases use an independent version from GcdsWrapper.Blazor.Markdown/GcdsWrapper.Blazor.Markdown.csproj and markdown-v*.*.* tags, for example:

git tag markdown-v0.1.0
git push origin markdown-v0.1.0

The GitHub Pages workflow publishes the static demo from the released commit after the NuGet release workflow succeeds. It can also be run manually when a documentation-only deployment is needed.

Updating GCDS

The upstream version is centralized in GcdsVersion.Components. Change that constant only after reviewing the GCDS changelog, then build the library, run the tests, and exercise the demo against the new assets.

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. 
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 GcdsWrapper.Blazor:

Package Downloads
GcdsWrapper.Blazor.Markdown

Render Markdown as GC Design System components in Blazor applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.1 202 11/17/2026
0.3.0 436 10/26/2026
0.2.1 1,726 9/12/2026
0.2.0 352 9/8/2026
0.1.2 120 8/30/2026
0.1.1 122 8/29/2026
0.1.0 2,343 8/27/2026