Ant Design Svelte

Listy

Virtual lists, grouping, sticky headings and jumps to posts.

When to use

Listy displays long lists with virtualization, groups and sticky headings. It is suitable for stream of posts, contacts and grouped results. For a set of columns and table operations, use Table; headers, loading and pagination around Listy is collected by the application.

Listy CSS Prefixes show global ConfigProvider.prefixCls and local prefixCls without resetting state. Listy is an independent component of the package. The prefix applies in raw and virtual modes, to groups and scrollbars. When changing the prefix, lines and scrolling are preserved; mode switching is shown separately.

Data and virtual window

items contains the source objects. rowKey is required: field name or stable key getter, without fallback to the index. itemRender — Svelte snippet with an object and its index in the original items.

Problem Setting Example
Output a small set items, rowKey, itemRender Short set
Limit the number of DOM lines virtual, positive height Virtualization
Group and pin headings group, sticky Groups
Show different heights DOM measurement Rich Content
Add data as you scroll onScroll Loading

Local virtual takes precedence over ConfigProvider.virtual. The window needs a positive height; without it or with height=0, all lines are displayed. Virtual mode measures the content after mount and recalculates the window when resized. Do not change rowKey when editing text: the key retains its identity and measurement results.

Groups and software scrolling

group.key calculates the group key, title-snippet gets this key and the source objects. Groups are collected throughout items in order of first appearance; itemRender preserves the original index of the entry. sticky sticks titles inside a scrollable area.

bind:ref provides scrollTo after mount. The method accepts a pixel offset, a top/left object, a record key, or a groupKey. align selects top/bottom/auto, offset adds indent. In normal mode, the target of a group is its section, in virtual mode it is the title line.

onScroll currentTarget is the root of a regular list or the holder of a virtual one. When loading, check the status of the request, the remainder of the scroll and the availability of the next portion. The example adds local data; network cancellation and error handling must be implemented by the application. The load button retains access to the same operation without hitting the exact end of the scroll.

Content, topic and restrictions

Empty does not appear automatically. Filtering, message without results, header/footer, loading and pagination are arranged around the list. Search shows such an empty state explicitly.

Rearrangement is the logic of the items owner. Sorting uses native drag for desktop and buttons; sensors and touch behavior of the external React dnd-kit are not added. rowHoverable and scrollWidth from Ant Design 6.7 are not yet available in the public Svelte API.

ConfigProvider.listy sets the general class/style and semantic settings of root/item/groupHeader. Callback gets initial props before defaults. The itemPaddingBlock/itemPaddingInline component design tokens are applied via theme.components.Listy; Semantic styles allow you to refine a specific area. An arbitrary prefixCls changes the classes, but does not generate the corresponding inline CSS.

The custom line markup is responsible for the available names, links, and buttons. Virtualization is not lookup: invisible entries may not be in the DOM. Don't pass off a list as a full-fledged listbox without a selection model and a keyboard.

Examples

1. Documentation
2. Examples
3. Versions
4. Support

Shortlist

items, required rowKey and custom row markup via itemRender.

Virtual window

A thousand entries, positive height, virtual and transition to the key via ref.scrollTo.

Groups and sticky titles

group.key, title Snippet, sticky and programmatic transition to the group in normal and virtual modes.

Rows of different heights

Additional text changes line height; the virtual window respects DOM dimensions.

Documentation
Examples
Versions
Support
Документация, Примеры, Версии, Поддержка

Changing the order

Adaptation of drag sorting via native drag and movement buttons; React dnd-kit is not connected.

Uploaded: 20 from 80

Loading when scrolling

onScroll adds the next local portion. The button performs the same action from the keyboard.

Design · 2
Anna
Boris
Development · 1
Vera
Design · 2
Anna
Boris
Development · 1
Vera

Semantic DOM and ConfigProvider

Semantic styles object and function, common ConfigProvider.listy and slots highlighting.

Анна
Борис
Вера
Found: 3

Search and empty state

Filtering belongs to the application; Empty is shown explicitly if there are no matches.

List from review

Saved example: 200 records, grouping, going to the last record and returning to the beginning.

General: suite; local: project-listy

Listy is an independent component of the package. The prefix applies in raw and virtual modes, to groups and scrollbars. When changing the prefix, lines and scrolling are preserved; mode switching is shown separately.

CSS prefixes Listy

Common namespace ConfigProvider and local prefixCls; the state of the component is preserved when the name is changed.

API

Verified against eight ant.design 6.7.0 themes and public Svelte API based on 6.6.8. scrollWidth and rowHoverable, introduced in 6.7.0, has not yet been transferred. Full definitions of Props are in the package.

Topics of official examples
ThemeExample or limitation
BasicKeys and own markings.
Virtual scrollingWindow of thousands of records.
Horizontal scrollingscrollWidth was added in ant.design 6.7.0 and is missing from the current Svelte API based on 6.6.8.
Grouping and sticky headersRaw/virtual and scrollTo groups.
Rich contentMeasuring lines of varying height.
Drag sortingNative drag and buttons. Integration with React dnd-kit was not ported.
Infinite loadingonScroll, local portions and virtual.
Custom semantic dom stylingObject, function and context settings.
Main parameters
PropertyDescriptionTypeDefault
prefixClsFull CSS prefix of the component and its parts. A non-empty local prop takes precedence; empty string and undefined inherit ConfigProvider. The namespace of the topic is set separately.stringConfigProvider.prefixCls + "-listy"
itemsOriginal records.readonly T[][]
rowKeyStable key; There is no automatic fallback to the index.keyof T | (item) => ListyKeyis required
itemRenderContents of the string. The index refers to the original items.Snippet<[T, number]>is required
heightScrollable area height; a positive value is needed for a virtual window.number—
virtualMounts only part of the lines at a given height.booleancontext / false
groupkey calculates the group, title - Snippet of the title.ListyGroup<T, K>—
stickyFreezes the title of the current group.booleanfalse
onScrollcurrentTarget - root in raw mode or internal holder in virtual mode. onscroll is a compatible alias.native UIEvent handler—
stylesCSS lines root/item/groupHeader; object or function with raw props.ListySemantic—
classNamesClasses root/item/groupHeader; object or function.ListySemantic—
nativeElementbind:nativeElement - root div; in virtual mode it wraps the holder.HTMLDivElementafter mount
refbind:ref provides scrollTo; binding is cleared upon unmount.ListyRefafter mount

Group

key calculates the string, numeric, or bigint key of a group. Records with the same key are merged across all items in the order of the first occurrence of the group. title — Snippet<[groupKey, items]>. The itemRender index remains the index of the original entry.

ref.scrollTo

ArgumentAction
numberVertical offset in pixels.
{ top?, left? }Absolute position; horizontal virtual window is not implemented in the current package.
{ key, align?, offset? }Record by rowKey; align: top, bottom or auto.
{ groupKey, align?, offset? }Group header in virtual mode, group section in raw mode.

Semantic DOM

Listy uses div containers; itemRender markup belongs to the application. A simple example shows list/listitem and entry numbers. Links, fields and buttons within a row retain native semantics and Tab order.

SlotPurpose
rootRoot container of the list.
itemRecord container: padding, separator and hover.
groupHeaderGroup title, including pinned copy.

ConfigProvider.listy specifies the general class/style and semantic styles. Local meanings complement and clarify the context. The function receives the initial props, before applying defaults. Turn on the highlight in the example to see the boundaries of the slots.

Registration tokens

The itemPaddingBlock and itemPaddingInline component tokens are applied via theme.components.Listy. Semantic styles allow you to specify local indentations. An arbitrary prefixCls changes the classes but does not generate the corresponding CSS.

Component tokens
TokenPurpose
itemPaddingBlockVertical record indents.
itemPaddingInlineHorizontal record indents.
Common tokens of the current topic
TokenMeaning
colorTextrgba(0,0,0,0.88)
colorTextDescriptionrgba(0,0,0,0.45)
colorBgContainer#ffffff
colorSplitrgba(5,5,5,0.06)
controlItemBgHoverrgba(0,0,0,0.04)
fontSize14
lineHeight1.5714285714285714
fontWeightStrong600

FAQ

Why does virtual output all lines?

Check the positive height and length of the content. Without height or zero, the virtual window does not limit the list.

Where is loading, pagination and Empty?

They are added by an application around Listy. Empty items by itself does not create an Empty.

How do lines of different heights work?

After mount the list measures the DOM. Preserve rowKey when content changes.

Has drag sorting been completely transferred?

No. The example is adapted using native drag and buttons; external React sensors are not included in it.