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

Function SelectionDynamic

packages/react-aria-components/test/Menu.test.tsx:2248–2273  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

2246}
2247
2248function SelectionDynamic(props) {
2249 let {selectionMode = 'single'} = props;
2250 let [selected, setSelected] = React.useState<Selection>(new Set());
2251 return (
2252 <MenuTrigger>
2253 <Button>Menu Button</Button>
2254 <Popover>
2255 <Menu
2256 aria-label="Test"
2257 items={withSection}
2258 selectionMode={selectionMode}
2259 selectedKeys={selected}
2260 onSelectionChange={setSelected}>
2261 {section => (
2262 <MenuSection>
2263 <Header>{section.name}</Header>
2264 <Collection items={section.children}>
2265 {item => <MenuItem>{item.name}</MenuItem>}
2266 </Collection>
2267 </MenuSection>
2268 )}
2269 </Menu>
2270 </Popover>
2271 </MenuTrigger>
2272 );
2273}
2274
2275AriaMenuTests({
2276 prefix: 'rac-static',

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected