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

Function ComponentCardView

packages/dev/s2-docs/src/ComponentCardView.tsx:26–94  ·  view source on GitHub ↗
({
  items,
  ariaLabel = 'Items',
  size = 'S',
  currentUrl,
  onAction,
  renderEmptyState
}: ComponentCardGridProps)

Source from the content-addressed store, hash-verified

24}
25
26export function ComponentCardView({
27 items,
28 ariaLabel = 'Items',
29 size = 'S',
30 currentUrl,
31 onAction,
32 renderEmptyState
33}: ComponentCardGridProps) {
34 return (
35 <InternalCardViewContext.Provider value={{ElementType: ListBoxItem as any, layout: 'grid'}}>
36 <ImageCoordinator>
37 <ListBox
38 aria-label={ariaLabel}
39 layout="grid"
40 selectionMode="single"
41 selectionBehavior="replace"
42 // @ts-ignore
43 linkBehavior="override"
44 autoFocus={!!currentUrl}
45 selectedKeys={currentUrl ? [currentUrl] : []}
46 disallowEmptySelection
47 onAction={onAction}
48 className={style({
49 display: {
50 default: 'grid',
51 isEmpty: 'flex'
52 },
53 gridTemplateColumns: {
54 default: 'repeat(auto-fill, minmax(150px, 1fr))',
55 md: 'repeat(auto-fill, minmax(200px, 1fr))'
56 },
57 gridAutoRows: 'max-content',
58 gap: 16,
59 padding: {
60 default: 12,
61 md: 16
62 },
63 scrollPadding: 8,
64 marginX: {
65 default: -12,
66 md: 0
67 },
68 alignItems: {
69 isEmpty: 'center'
70 },
71 justifyContent: {
72 default: 'space-between',
73 isEmpty: 'center'
74 },
75 overflow: 'auto',
76 flexGrow: 1,
77 position: 'relative'
78 })}
79 renderEmptyState={renderEmptyState}
80 items={items}>
81 {item => (
82 <ComponentCard
83 id={item.id}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected