@arolariu/components
Version:
🎨 70+ beautiful, accessible React components built on Base UI. TypeScript-first, CSS Modules styling, tree-shakeable, SSR-ready. Perfect for modern web apps, design systems & rapid prototyping. Zero config, maximum flexibility! ⚡
30 lines • 889 B
TypeScript
/**
* Generates a unique, stable identifier that is safe for server-side rendering.
*
* @remarks
* This hook wraps React's `useId` and optionally prepends a custom prefix.
* The generated ID remains stable across re-renders and matches between server
* and client, making it ideal for associating form labels with inputs or
* managing accessible ARIA relationships.
*
* @param prefix - Optional string to prepend to the generated ID.
* @returns A unique identifier string.
*
* @example
* ```tsx
* function FormField({label}) {
* const id = useId("field");
*
* return (
* <div>
* <label htmlFor={id}>{label}</label>
* <input id={id} type="text" />
* </div>
* );
* }
* ```
*
* @see {@link https://react.dev/reference/react/useId | React useId}
*/
export declare function useId(prefix?: string): string;
//# sourceMappingURL=useId.d.ts.map