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

Function ListBox

packages/react-aria/stories/combobox/example.tsx:129–150  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

127}
128
129function ListBox(props) {
130 let ref = React.useRef(undefined);
131 let {listBoxRef = ref, state} = props;
132 let {listBoxProps} = useListBox(props, state, listBoxRef);
133
134 return (
135 <ul
136 {...listBoxProps}
137 ref={listBoxRef}
138 style={{
139 margin: 0,
140 padding: 0,
141 listStyle: 'none',
142 maxHeight: '150px',
143 overflow: 'auto'
144 }}>
145 {[...state.collection].map(item => (
146 <Option key={item.key} item={item} state={state} />
147 ))}
148 </ul>
149 );
150}
151
152function Option({item, state}) {
153 let ref = React.useRef<HTMLLIElement | null>(null);

Callers

nothing calls this directly

Calls 1

useListBoxFunction · 0.90

Tested by

no test coverage detected