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

Function AsyncComboBox

packages/react-aria-components/test/ComboBox.test.js:1124–1147  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1122 }
1123
1124 function AsyncComboBox() {
1125 let list = useAsyncList({
1126 getKey: item => item.id,
1127 async load({filterText}) {
1128 let rows = itemsForFilterText(filterText);
1129 await new Promise(resolve => setTimeout(resolve, ASYNC_DELAY_MS));
1130 return {items: rows};
1131 }
1132 });
1133
1134 return (
1135 <ComboBox
1136 items={list.items}
1137 inputValue={list.filterText}
1138 onInputChange={list.setFilterText}>
1139 <Label>SW Characters</Label>
1140 <Input />
1141 <Button>{'<'}</Button>
1142 <Popover>
1143 <ListBox>{item => <ListBoxItem id={item.id}>{item.name}</ListBoxItem>}</ListBox>
1144 </Popover>
1145 </ComboBox>
1146 );
1147 }
1148
1149 let {container, queryByRole} = render(<AsyncComboBox />);
1150 let comboboxTester = testUtilUser.createTester('ComboBox', {root: container});

Callers

nothing calls this directly

Calls 1

useAsyncListFunction · 0.90

Tested by

no test coverage detected