MCPcopy
hub / github.com/adobe/react-spectrum / useSlotId2

Function useSlotId2

packages/react-aria/src/utils/useSlot.ts:47–55  ·  view source on GitHub ↗
(initialState: boolean | (() => boolean) = true)

Source from the content-addressed store, hash-verified

45}
46
47export function useSlotId2(initialState: boolean | (() => boolean) = true): SlotAria {
48 let id = useId();
49 let [ref, hasSlot] = useSlot(initialState);
50
51 return {
52 id: hasSlot ? id : undefined,
53 ref
54 };
55}

Callers 2

useRadioFunction · 0.90
useToggleFunction · 0.90

Calls 2

useIdFunction · 0.90
useSlotFunction · 0.70

Tested by

no test coverage detected