import { createUniqueId } from "solid-js"; /** * Returns a stable, component-unique ID. * * If the caller passes an override, it wins. Otherwise we generate an ID once * for the owning component via Solid's `createUniqueId()`. * * Note: `createUniqueId()` MUST be called during component setup (not inside * an effect) so the generated id is tied to the component's owned scope and * stable for its lifetime. We only call it when there is no override — no * point in burning a slot when the consumer already has an ID. */ export function useBaseUiId(idOverride?: string): string { return idOverride ?? createUniqueId(); }