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

Function ListBox

packages/react-aria/stories/select/example.tsx:98–119  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

96}
97
98function ListBox(props) {
99 let ref = React.useRef(undefined);
100 let {listBoxRef = ref, state} = props;
101 let {listBoxProps} = useListBox(props, state, listBoxRef);
102
103 return (
104 <ul
105 {...listBoxProps}
106 ref={listBoxRef}
107 style={{
108 margin: 0,
109 padding: 0,
110 listStyle: 'none',
111 maxHeight: '150px',
112 overflow: 'auto'
113 }}>
114 {[...state.collection].map(item => (
115 <Option key={item.key} item={item} state={state} />
116 ))}
117 </ul>
118 );
119}
120
121function Option({item, state}) {
122 let ref = React.useRef(null);

Callers

nothing calls this directly

Calls 1

useListBoxFunction · 0.90

Tested by

no test coverage detected