sanity
Version:
Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches
15 lines (13 loc) • 385 B
text/typescript
import {type ReactNode} from 'react'
/**
* Creates a description id from a field id, for use with aria-describedby in the field,
* and added to the descriptive element id.
* @internal
*/
export function createDescriptionId(
id: string | undefined,
description: ReactNode | undefined,
): string | undefined {
if (!description || !id) return undefined
return `desc_${id}`
}