Soenneker.Blazor.Utils.Ids
11.0.64
Prefix Reserved
dotnet add package Soenneker.Blazor.Utils.Ids --version 11.0.64
NuGet\Install-Package Soenneker.Blazor.Utils.Ids -Version 11.0.64
<PackageReference Include="Soenneker.Blazor.Utils.Ids" Version="11.0.64" />
<PackageVersion Include="Soenneker.Blazor.Utils.Ids" Version="11.0.64" />
<PackageReference Include="Soenneker.Blazor.Utils.Ids" />
paket add Soenneker.Blazor.Utils.Ids --version 11.0.64
#r "nuget: Soenneker.Blazor.Utils.Ids, 11.0.64"
#:package Soenneker.Blazor.Utils.Ids@11.0.64
#addin nuget:?package=Soenneker.Blazor.Utils.Ids&version=11.0.64
#tool nuget:?package=Soenneker.Blazor.Utils.Ids&version=11.0.64
Soenneker.Blazor.Utils.Ids
A thread-safe, allocation-conscious generator for related DOM IDs in Blazor components.
It produces readable process-unique IDs such as email-42 and derived IDs such as email-42-label, making it useful for id, for, aria-labelledby, and aria-describedby relationships.
Installation
dotnet add package Soenneker.Blazor.Utils.Ids
No service registration is required.
Generate once per component instance
Store the generated ID in a field so it remains stable across renders:
@using Soenneker.Blazor.Utils.Ids
<label id="@_labelId" for="@_inputId">Email</label>
<input id="@_inputId" aria-labelledby="@_labelId" />
@code {
private string _inputId = null!;
private string _labelId = null!;
protected override void OnInitialized()
{
_inputId = BlazorIdGenerator.New("email");
_labelId = BlazorIdGenerator.Child(_inputId, "label");
}
}
Do not call New directly in Razor markup, a computed property, or BuildRenderTree; each call consumes a new number and would change the element ID on subsequent renders.
Generate related IDs
string rootId = BlazorIdGenerator.New("dialog");
string titleId = BlazorIdGenerator.Child(rootId, "title");
string contentId = BlazorIdGenerator.Child(rootId, "content");
Child only concatenates the parent and suffix. It does not reserve or independently guarantee uniqueness, so use distinct suffixes beneath a unique parent.
Prefixes, parent IDs, and suffixes must be non-empty and cannot contain whitespace. Other characters are preserved. If an ID is later embedded in a CSS selector, escape it with CSS.escape rather than assuming every valid DOM ID is a valid unescaped CSS identifier.
Uniqueness and rendering boundaries
New uses one atomic, monotonically increasing counter for the process. Values are unique among calls in that process, but they are not stable across application restarts and are not coordinated across multiple server processes or browser tabs.
Server prerendering and client-side rendering run in different processes. Do not expect a newly generated client ID to reproduce the server value. When continuity across that boundary matters, persist the value with Blazor state transfer or derive it from stable application data.
The numeric suffix is predictable. These IDs are for UI identity, not secrets, authorization checks, CSRF protection, public resource identifiers, or security tokens.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.Atomics.Longs (>= 11.0.38)
- Soenneker.Extensions.Long (>= 11.0.249)
- Soenneker.Extensions.Spans.Chars (>= 11.0.63)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Soenneker.Blazor.Utils.Ids:
| Package | Downloads |
|---|---|
|
Soenneker.Blazor.Utils.JsVariable
A Blazor interop library that checks (and waits) for the existence of a JS variable |
|
|
Soenneker.Blazor.MediaQuery
A Blazor interop library for media queries for viewport size logic |
|
|
Soenneker.Blazor.WebWorkers
Web Worker orchestration in Blazor. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.64 | 3,253 | 11/11/2026 |
| 11.0.63 | 566 | 11/11/2026 |
| 11.0.62 | 1,158 | 11/11/2026 |
| 11.0.61 | 556 | 11/10/2026 |
| 11.0.60 | 97 | 11/10/2026 |
| 11.0.59 | 15,339 | 10/26/2026 |
| 11.0.58 | 300 | 10/26/2026 |
| 11.0.57 | 685 | 10/26/2026 |
| 4.0.56 | 9,009 | 10/15/2026 |
| 4.0.55 | 98 | 10/15/2026 |
| 4.0.54 | 104 | 10/15/2026 |
| 4.0.53 | 251 | 10/14/2026 |
| 4.0.49 | 1,985 | 10/14/2026 |
| 4.0.48 | 101 | 10/14/2026 |
| 4.0.42 | 742 | 10/13/2026 |
| 4.0.41 | 271 | 10/12/2026 |
| 4.0.39 | 1,534 | 10/12/2026 |
| 4.0.38 | 1,659 | 10/12/2026 |
| 4.0.37 | 1,092 | 10/11/2026 |
| 4.0.36 | 432 | 10/11/2026 |
Updated Multiple NuGet packages