Skip to main content
cngx-src documentation

nextUid

Functioncore/utilsv0.1.0

projects/core/utils/uid.util.ts

Description#

Generates a unique ID string with the given prefix.

Each call returns a monotonically increasing ID: prefix-0, prefix-1, etc. Used internally for ARIA id attributes on dialogs, popovers, and tooltips.

The counter is module-level and per JS realm, so IDs are not stable across an SSR render and its client hydration - the server and the browser each count from 0 in their own creation order, and the ids can diverge. The impact is bounded because every cngx consumer re-binds the generated id through signals after hydration, but do not persist a nextUid value or use it as a cross-request key.

Signature#

nextUid(prefix: string)

Parameters#

@paramprefixstring

Returns#

string