Skip to content

Unique id

@xngui/cdk/unique-id
@xngui/cdk/unique-id

SSR-safe unique id generator for aria-* wiring.

Preview

Field wiring

We never share your email.

input x-ng-field-3 · hint x-ng-hint-4

Generated ids

  • Press the button to append ids
import { XUniqueId } from '@xngui/cdk/unique-id';
 
const uniqueId = inject(XUniqueId);
const fieldId = uniqueId.next('field');
const hintId = uniqueId.next('hint');
 
<x-form-field label="Email">
<x-input [controlId]="fieldId" [attr.aria-describedby]="hintId" >
<x-form-field>
<p [id]="hintId">We never share your email.<p>

Events

Interact with the preview — events will appear here.