MCPcopy Create free account
hub / github.com/adobe/react-spectrum / MenuInner

Function MenuInner

starters/hooks/src/Menu.tsx:99–119  ·  view source on GitHub ↗
({
  collection,
  ...props
}: AriaMenuOptions<object> &
  Omit<TreeProps<object>, 'children'> & {
    collection: ICollection<Node<object>>;
  })

Source from the content-addressed store, hash-verified

97}
98
99function MenuInner({
100 collection,
101 ...props
102}: AriaMenuOptions<object> &
103 Omit<TreeProps<object>, 'children'> & {
104 collection: ICollection<Node<object>>;
105 }) {
106 let state = useTreeState({...props, collection, children: undefined});
107 let ref = useRef<HTMLUListElement>(null);
108 let {menuProps} = useMenu(props, state, ref);
109
110 return (
111 <ul {...menuProps} ref={ref} className="react-aria-Menu">
112 <TreeStateContext.Provider value={state}>
113 {[...state.collection].map(item => (
114 <Fragment key={item.key}>{item.render!(item)}</Fragment>
115 ))}
116 </TreeStateContext.Provider>
117 </ul>
118 );
119}

Callers

nothing calls this directly

Calls 2

useTreeStateFunction · 0.90
useMenuFunction · 0.90

Tested by

no test coverage detected