UNPKG

react-unique-id-generator

Version:

A lightweight, zero-dependency library for generating unique, sequential IDs in React — with hooks, custom prefix/suffix, SSR support, and stable CSS selector generation

27 lines 1.06 kB
export type AutomationIdStrategy = 'sequential' | 'kebab-case' | 'camelCase' | 'custom'; export interface AutomationIdOptions { strategy?: AutomationIdStrategy; prefix?: string; separator?: string; customFn?: (componentName: string, index: number) => string; } export declare function generateAutomationId(componentName: string, options?: AutomationIdOptions): string; export declare function resetAutomationCounter(): void; export declare function useAutomationId(componentName: string, options?: AutomationIdOptions): string; export declare class AutomationIdPool { private available; private released; private counter; private readonly componentName; private readonly strategy; private readonly prefix; private readonly separator; constructor(poolSize: number, componentName?: string, options?: Omit<AutomationIdOptions, 'customFn'>); private createId; private fill; acquire(): string; release(id: string): void; drain(): void; get size(): number; } //# sourceMappingURL=automation.d.ts.map