Skip to content

useId

SSR-safe unique id with an optional override.

Signature

useId(providedId?, prefix?): string

Parameters

NameTypeDescription
providedIdstring | undefinedExplicit id; skips React id generation.
prefixstringPrefix for generated ids (default "ui").

Returns

Stable id string, colon-free for CSS/querySelector.

SSR notes

Uses React useId — matches server and client without hydration mismatch.

Import

import { useId } from "@gunkin/uiify/hooks";