Docs
βš™οΈ ⏐ Utils
useId

Id

Autogenerate IDs to facilitate WAI-ARIA.

A string can be supplied as an argument to be useId in lieu of the auto-generated ID. This is handy for accepting user-provided prop IDs that need to be deterministic.

Examples

// Auto generate one...
const id = useId();
 
// Provide your own...
const myId = useId('foo-1');