Part of the Ant Design ecosystem.
📜 Virtualized React list component with grouping and sticky header support.
English | 简体中文
| Area | Support |
|---|---|
| Purpose | Virtualized React list component with grouping and sticky header support. |
| Package | @rc-component/listy |
| Release | @rc-component/np / rc-np |
npm install @rc-component/listyimport Listy from '@rc-component/listy';
import '@rc-component/listy/assets/index.css';
const items = Array.from({ length: 100 }, (_, index) => ({ id: index, name: `Item ${index}` }));
export default () => (
<Listy
items={items}
height={240}
itemHeight={32}
rowKey="id"
itemRender={(item) => <div>{item.name}</div>}
/>
);| Prop | Description | Type | Default |
|---|---|---|---|
items |
List data source. | T[] |
[] |
rowKey |
Resolve item identity. | keyof T | (item: T) => React.Key |
required |
itemRender |
Render each item. | (item: T, index: number) => React.ReactNode |
required |
height |
Viewport height. | number |
- |
itemHeight |
Estimated item height. | number |
- |
group |
Group configuration. | { key: (item: T) => K; title: (groupKey: K, items: T[]) => React.ReactNode } |
- |
sticky |
Enable sticky group headers. | boolean |
false |
virtual |
Enable virtual scrolling. | boolean |
true |
onScroll |
Triggered when the inner scroll container scrolls. | React.UIEventHandler<HTMLElement> |
- |
prefixCls |
Component class name prefix. | string |
rc-listy |
| Method | Description |
|---|---|
scrollTo(config) |
Scroll to a position, item key, or group key. |
npm install
npm start
npm test
npm run lint
npm run compileThe dumi site runs at http://localhost:8000.
npm run prepublishOnlyThe release flow is handled by @rc-component/np through the rc-np command when the package uses the shared release flow.
@rc-component/listy is released under the MIT license.