petyosi/react-virtuoso

Public

The most powerful virtual list component for React

  • Stars6.5k+8 tuần này
  • Forks367
  • Watchers27
  • Issues44
  • Ngày tạo03/05/2019
  • Cập nhật gần nhất09/11/2026
  • Ngôn ngữTypeScript
  • Giấy phép—
README.md11.2 KBRaw

React Virtuoso

NPM version

The most complete React virtualization rendering family of components.

Get Started

npm install react-virtuoso
import { Virtuoso } from 'react-virtuoso'

const App = () => {
  return <Virtuoso style={{ height: '400px' }} totalCount={200} itemContent={(index) => <div>Item {index}</div>} />
}

ReactDOM.render(<App />, document.getElementById('root'))

Documentation

For in-depth documentation and live examples of all supported features, check the documentation website.

Components

The Virtuoso message list component is built specifically for human/chatbot conversations. In addition to the virtualized rendering, the component exposes an imperative data management API that gives you the necessary control over the scroll position when older messages are loaded, new messages arrive, and when the user submits a message. The scroll position can update instantly or with a smooth scroll animation.

The GroupedVirtuoso component is a variant of the flat Virtuoso component, with the following differences:

  • Instead of totalCount, the component exposes groupCounts: number[] property, which specifies the amount of items in each group. For example, passing [20, 30] will render two groups with 20 and 30 items each;
  • In addition the itemContent property, the component requires an additional groupContent property, which renders the group header. The groupContent callback receives the zero-based group index as a parameter.

The VirtuosoGrid component displays same sized items in multiple columns. The layout and item sizing is controlled through CSS class properties, which allows you to use media queries, min-width, percentage, etc.

Nội dung README thuộc về petyosi và cộng đồng đóng góp, giấy phép Không có giấy phép. Nguồn: github.com/petyosi/react-virtuoso