Soenneker.Blazor.C15t
11.0.157
Prefix Reserved
dotnet add package Soenneker.Blazor.C15t --version 11.0.157
NuGet\Install-Package Soenneker.Blazor.C15t -Version 11.0.157
<PackageReference Include="Soenneker.Blazor.C15t" Version="11.0.157" />
<PackageVersion Include="Soenneker.Blazor.C15t" Version="11.0.157" />
<PackageReference Include="Soenneker.Blazor.C15t" />
paket add Soenneker.Blazor.C15t --version 11.0.157
#r "nuget: Soenneker.Blazor.C15t, 11.0.157"
#:package Soenneker.Blazor.C15t@11.0.157
#addin nuget:?package=Soenneker.Blazor.C15t&version=11.0.157
#tool nuget:?package=Soenneker.Blazor.C15t&version=11.0.157
Soenneker.Blazor.C15t
A Blazor wrapper around the c15t consent runtime, with scoped state, consent actions, and a cascading provider.
Installation
dotnet add package Soenneker.Blazor.C15t
Registration
using Soenneker.Blazor.C15t.Registrars;
builder.Services.AddC15t();
Initialize the consent runtime
Wrap the application content with C15tProvider. It initializes after the first render, when JavaScript interop is available, and cascades IC15tConsentService to descendants.
@using Soenneker.Blazor.C15t
@using Soenneker.Blazor.C15t.Models
<C15tProvider Options="_options">
<Router AppAssembly="@typeof(App).Assembly">
...
</Router>
</C15tProvider>
@code {
private readonly C15tOptions _options = new()
{
Mode = "offline",
ConsentCategories =
[
"necessary",
"functionality",
"experience",
"measurement",
"marketing"
]
};
}
The provider does not delay rendering its children. Code that loads analytics, marketing, or other optional resources must still check consent before running.
Read and change consent
@using Soenneker.Blazor.C15t.Abstract
@inject IC15tConsentService Consent
<button @onclick="async () => await Consent.AcceptAll()">Accept all</button>
<button @onclick="async () => await Consent.RejectNonNecessary()">Necessary only</button>
@if (Consent.HasConsent("measurement"))
{
<p>Analytics may be enabled.</p>
}
CurrentState is the last state returned by an operation through this scoped service. Refresh() reads the runtime again. For a custom preferences UI, call SetSelectedConsent(category, value) for each pending choice and then SaveCustom(); SetConsent() saves one category immediately.
AcceptAll(), RejectNonNecessary(), ResetConsents(), OpenDialog(), ShowBanner(), and CloseUi() all return the resulting state and update CurrentState.
Runtime options
- With no backend URL, the wrapper selects offline mode.
BackendUrlandModeconfigure a hosted or self-hosted c15t consent manager.ConsentCategoriesis forwarded as c15t's initial GDPR categories.ExtensionDataforwards additional c15t options without requiring wrapper changes.ModuleUrldefaults to the pinned c15t ESM package on jsDelivr. Relative same-origin URLs are supported for self-hosting.
The module URL must resolve to HTTPS, except for loopback HTTP development URLs. It is executable code: only configure a module location you control or explicitly trust. If a Content Security Policy is enabled, allow the selected module origin and any configured backend origin.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Microsoft.AspNetCore.Components.Web (>= 11.0.0)
- Soenneker.Blazor.Extensions.IJSObjectReferences (>= 11.0.6)
- Soenneker.Blazor.Utils.ResourceLoader (>= 11.0.1840)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Soenneker.Blazor.C15t:
| Package | Downloads |
|---|---|
|
Soenneker.Quark.Suite
Shadcn-powered Blazor UI, refined and modular. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.157 | 0 | 11/15/2026 |
| 11.0.156 | 42 | 11/14/2026 |
| 11.0.155 | 56 | 11/14/2026 |
| 11.0.154 | 1,015 | 11/12/2026 |
| 11.0.153 | 52 | 11/12/2026 |
| 11.0.152 | 235 | 11/12/2026 |
| 11.0.151 | 48 | 11/12/2026 |
| 11.0.150 | 160 | 11/11/2026 |
| 11.0.149 | 169 | 11/11/2026 |
| 11.0.148 | 139 | 11/11/2026 |
| 11.0.147 | 139 | 11/11/2026 |
| 11.0.146 | 140 | 11/11/2026 |
| 11.0.144 | 92 | 11/11/2026 |
| 11.0.143 | 187 | 11/11/2026 |
| 11.0.142 | 58 | 11/11/2026 |
| 11.0.141 | 204 | 11/11/2026 |
| 11.0.140 | 54 | 11/11/2026 |
| 11.0.139 | 50 | 11/11/2026 |
| 11.0.138 | 2,406 | 11/4/2026 |
| 11.0.137 | 61 | 11/4/2026 |
Update dependency Soenneker.Blazor.Utils.ResourceLoader to 11.0.1840 (#577)