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

Function ListBoxInner

starters/hooks/src/ListBox.tsx:60–85  ·  view source on GitHub ↗
({
  collection,
  ...props
}: AriaListBoxOptions<object> &
  Omit<ListProps<object>, 'children'> & {collection: ICollection<Node<object>>})

Source from the content-addressed store, hash-verified

58}
59
60function ListBoxInner({
61 collection,
62 ...props
63}: AriaListBoxOptions<object> &
64 Omit<ListProps<object>, 'children'> & {collection: ICollection<Node<object>>}) {
65 /*- begin highlight -*/
66 let state = useListState({...props, collection, children: undefined});
67 let ref = useRef<HTMLDivElement>(null);
68 let {listBoxProps} = useListBox(props, state, ref);
69 /*- end highlight -*/
70
71 return (
72 <div
73 {...listBoxProps}
74 ref={ref}
75 className="react-aria-ListBox"
76 data-layout="stack"
77 data-orientation="vertical">
78 <ListStateContext.Provider value={state}>
79 {[...state.collection].map(item => (
80 <Fragment key={item.key}>{item.render!(item)}</Fragment>
81 ))}
82 </ListStateContext.Provider>
83 </div>
84 );
85}

Callers

nothing calls this directly

Calls 2

useListStateFunction · 0.90
useListBoxFunction · 0.90

Tested by

no test coverage detected