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

Function IconListBox

packages/dev/s2-docs/src/IconSearchView.tsx:101–128  ·  view source on GitHub ↗
({items, copiedId, onAction, listBoxClassName}: IconListBoxProps)

Source from the content-addressed store, hash-verified

99}
100
101function IconListBox({items, copiedId, onAction, listBoxClassName}: IconListBoxProps) {
102 return (
103 <Virtualizer
104 layout={GridLayout}
105 layoutOptions={{
106 minItemSize: new Size(64, 64),
107 maxItemSize: new Size(64, 64),
108 minSpace: new Size(12, 12),
109 preserveAspectRatio: true
110 }}>
111 <ListBox
112 onAction={item => onAction(item.toString())}
113 items={items}
114 layout="grid"
115 className={listBoxClassName || style({width: '100%', scrollPaddingY: 4, padding: 8})}
116 dependencies={[copiedId]}
117 renderEmptyState={() => (
118 <IllustratedMessage styles={style({marginX: 'auto', marginY: 32})}>
119 <NoSearchResults />
120 <Heading>No results</Heading>
121 <Content>Try a different search term.</Content>
122 </IllustratedMessage>
123 )}>
124 {item => <IconItem item={item} isCopied={copiedId === item.id} />}
125 </ListBox>
126 </Virtualizer>
127 );
128}
129
130const itemStyle = style({
131 ...focusRing(),

Callers

nothing calls this directly

Calls 2

toStringMethod · 0.65
onActionFunction · 0.50

Tested by

no test coverage detected