Skip to main content

List
component

A virtualized list component for efficiently rendering large datasets with customizable item rendering. You can view the Storybook for more interactive examples.

Was this section helpful?

List

import {List} from '@shopify/shop-minis-react'

const sampleItems = [
{id: '1', title: 'Item 1'},
{id: '2', title: 'Item 2'},
{id: '3', title: 'Item 3'},
{id: '4', title: 'Item 4'},
{id: '5', title: 'Item 5'},
]

export default function MyComponent() {
const getItemSize = () => 60

const renderItem = item => (
<div className="p-4 border-b">
<span>{item.title}</span>
</div>
)

return (
<List
items={sampleItems}
height={300}
itemSizeForRow={getItemSize}
showScrollbar
renderItem={renderItem}
/>
)
}

Preview

List configurations and use cases

A basic virtualized list with simple items

A virtualized list displaying product items

Was this section helpful?

Basic list

import {List} from '@shopify/shop-minis-react'

const sampleItems = [
{id: '1', title: 'Item 1'},
{id: '2', title: 'Item 2'},
{id: '3', title: 'Item 3'},
{id: '4', title: 'Item 4'},
{id: '5', title: 'Item 5'},
]

export default function MyComponent() {
const getItemSize = () => 60

const renderItem = item => (
<div className="p-4 border-b">
<span>{item.title}</span>
</div>
)

return (
<List
items={sampleItems}
height={300}
itemSizeForRow={getItemSize}
showScrollbar
renderItem={renderItem}
/>
)
}