Method UseId
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
UseId(string?)
Returns a stable unique ID string tied to the component instance and slot position. Re-renders of the same component return the same ID; different instances or different slots receive different IDs. Use as a unique key for label-to-field association or aria attributes.
public static string UseId(string? prefix = null)
Parameters
prefixstringOptional prefix to prepend (omitted when null/empty). Only the first render reflects this in the generated ID; changes on subsequent renders are ignored (same convention as the initial value of UseState).
Returns
- string
Format is
:r{hex}:(no prefix) or{prefix}:r{hex}:(with prefix).