Ant Design Svelte

Pagination

Page navigation, size selection, quick entry and custom elements.

When to use

Pagination divides a large set of posts into pages. It reports the page number and size, and the application controls the loading, filtering and output of data. You can use the built-in pagination Table for the table.

The prefix example lets you switch the shared ConfigProvider.prefixCls or the local prefixCls. The current page, the number you typed and the page item dimensions stay the same. The page size selector uses the shared prefix.

Page number and sample size

total - number of records, pageSize - number of records on the page, current starts from 1. defaultCurrent and defaultPageSize are read once. For external control and state saving, use bind:current and bind:pageSize.

Problem Setting Example
Paginate posts total, pageSize Main scenario
Select number of records showSizeChanger, pageSizeOptions Size selection
Go to number directly showQuickJumper Direct transition
Save state outside bindings External condition
Show quantity and range snippet showTotal Summary

When changing size, the package retains the page number and limits it to the new range. onChange gets page and pageSize; the third argument info.recommendPage from Ant Design 6.7 is not here yet. If you need to maintain the visibility of a specific entry, calculate the required number in the application.

The request SHOULD pass a matched page/pageSize pair. When changing filters, update the total and page number; Late responses from a previous request should not replace new data.

Presentation and additional elements

showSizeChanger enables Select. If prop is missing, it appears when total is above totalBoundaryShowSizeChanger, default 50. Use showSizeChanger.options to supply custom labels for page sizes. The object also accepts other Select props. Use components.sizeChanger to supply a snippet for a custom element with value, options, disabled and onChange.

showQuickJumper accepts a boolean or a goButton object. simple includes a compact representation; The readOnly object disables number editing. showLessItems reduces the number of adjacent pages, hideOnSinglePage hides navigation when there is a single page.

itemRender receives number, type, ready originalElement snippet and info with onClick, label, disabled and active handler. When replacing a finished button, save these properties on your own control. Transition icons also accept snippets. Details are shown in your rendering.

Dimensions, availability and limitations

align specifies start/center/end. size supports current large/medium/small. responsive operates without explicitly setting size or componentSize to the ConfigProvider. In a theme with the Source engine enabled, the xs border is taken from theme.token.screenXSMax; normal mode without theme uses the standard 575px. The nested provider inherits the threshold, theme.inherit:false returns the standard one. New design tokens are applied without remount, saving the page and draft jumper.

Example of thresholds compares 639px and 575px. It runs in a standalone Svelte context, since the gallery's common componentSize overwhelms responsive. On the server, the shell of this example shows a stub; Pagination itself supports SSR and does not add mini before mount. Incorrect order of screen* boundaries is rejected already with SSR.

responsive adds a mini class, but by itself does not guarantee a smaller height, as in the pinned Ant Design 6.6.8. For a fixed small size, specify small. The quick jump field is hidden by standard CSS at a width of up to 576px, regardless of theme.token.screenXSMax; the main navigation remains.

The root is nav, the pages are in the list. Provide a clear aria-label, especially if there is multiple Pagination on the page. Native rendering must maintain keyboard accessibility and the disabled state.

ConfigProvider.pagination sets general semantic defaults, showSizeChanger and its threshold. Component Pagination tokens change the sizes and states of items. class refers to ul, semantic root refers to nav. prefixCls changes DOM classes and styling. Changing the prefix preserves item dimensions in the compact theme as well. NativeElement-ref is not available yet.

Examples

Basic pagination

Five pages without choosing a size. The number of the active page is available through aria-current, transitions are performed by native buttons.

Alignment

align positions pagination at the beginning, center, or end of the available line.

Many pages

Transitions through ellipses shorten a long list. showLessItems reduces the number of adjacent pages.

Page 2, by 10 No events

Number of entries

showSizeChanger.options supplies labels for page sizes. bind:pageSize and bind:current store numeric values, and the handlers display both events.

Enter: 1; button: 1

Quick link

showQuickJumper accepts Enter or goButton confirmation. On a narrow screen, the field hides the standard responsive CSS.

small

medium

large

Dimensions

The package accepts small, medium and large. medium fits regular size; Setting up a local component takes precedence over the global one.

Input: 2; without input: 2

Simple mode

simple shows the current page and the total number of pages. readOnly removes number editing, preserving the transition buttons.

Application status

Two-way binding stores the number outside the Pagination. The application button returns the first page.

Total records

showTotal - Svelte Snippet with the total number and included borders of the current page.

All main features

Combines total quantity, size selection, quick navigation and regular page buttons in one line.

Page 1

Your own transition buttons

itemRender gets originalElement and info. Its native button uses info.onClick and info.disabled; the remaining elements retain the standard renderer.

By 10

Your choice of size

components.sizeChanger accepts a Snippet with options, value, disabled and onChange. The example uses the available native select.

Semantic styles and ConfigProvider

The general pagination configuration specifies root and size selection behavior. Local styles add styling to items.

Component tokens

Local theme changes the size of regular items and the color of the active page. The theme of the adjacent cards is preserved.

Unavailable state

disabled disables buttons and standard size selection. The setting can be switched without losing the number.

All entries are placed on one page; navigation is hidden.

Single page

hideOnSinglePage removes the entire navigation if all posts fit on one page.

Localization and RTL

ConfigProvider inherits direction and locale. The English available button names only apply to this card.

Page: 1. Entries on the page: 10.

Post pagination

Browse script with bind:current/pageSize and record range. The condition of this card is regardless of review.

Page: 2
General: suite; local: project-pagination

Changing the prefix preserves the item size, the current page and the number you typed. The page size selector uses the shared prefix.

CSS prefixes Pagination

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

The standalone example runs after mount.

This example has a separate context without componentSize. The general gallery settings do not apply to it: this way the priority of responsive is visible without changing the rest of the site cards.

responsive and theme thresholds

An independent example without a common componentSize: screenXSMax, inheritance and inherit:false, priority size and saving a quick-jump draft when changing tokens.

API

Examples are checked against the current ant.design page and the public API of the installed package. Full definitions of Props are in @woodger/antd.

Topics of official examples
ThemeExample or limitation
BasicRegular pages.
AlignThree alignments.
MoreLong list and shortened buffer.
ChangerSize and handlers.
JumperEnter and jump button.
Sizesmall, medium and large public package.
Simple modeEnter number and readOnly.
ControlledBinding and external control.
Total numbershowTotal-snippet.
Show AllSharing opportunities.
Prev and nextYour own itemRender and originalElement.
Custom componentcomponents.sizeChanger-snippet.
Custom semantic dom stylingDesign and ConfigProvider.pagination.
Main parameters Pagination
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 + "-pagination"
totalTotal number of records, not number of pages.number0
currentbind:current connects the number to the application state.numberdefaultCurrent: 1
defaultCurrentStarting number, read once.number1
pageSizebind:pageSize binds size to application state.numberdefaultPageSize: 10
defaultPageSizeInitial size, read once.number10
pageSizeOptionsStandard size selection options.readonly (number | string)[]10, 20, 50, 100
showSizeChangeroptions supplies choices with a numeric size and a label. The configuration also accepts Select settings and handlers.boolean | PaginationSizeChangerPropstotal > 50
totalBoundaryShowSizeChangerThreshold for automatically turning on size selection.number50
showQuickJumperTransition field Enter; goButton adds confirmation.boolean | { goButton?: PaginationContent }false
simpleCurrent number and number of pages; readOnly disables input.boolean | { readOnly?: boolean }false
showTotalRange of the current page with borders enabled.Snippet<[total, range]>—
showLessItemsFewer neighbors and the transition of the ellipsis to three pages.booleanfalse
showPrevNextJumpersShows transitions through ellipses.booleantrue
hideOnSinglePageHides the entire nav on one page.booleanfalse
alignLine alignment.'start' | 'center' | 'end'—
sizeLocal size takes precedence.'small' | 'medium' | 'large'From ConfigProvider
responsiveXS by theme.token.screenXSMax includes mini only without an explicitly specified size in props or provider. Tokens update queries without remount; The mini class itself does not guarantee a reduction in height.booleanfalse
disabledDisables control.booleanFrom ConfigProvider
onChangeTwo arguments; info.recommendPage from Ant Design 6.7.0 is missing yet.(page, pageSize) => void—
onShowSizeChangeWhen resizing, it is called before onChange.(previousPage, pageSize) => void—
itemRenderIts renderer binds info.onClick/disabled to native control.Snippet<[page, type, originalElement, info]>—
componentsCustomizable size selection.{ sizeChanger?: Snippet<[PaginationSizeChangerInfo]> }—
classNamesObject or function for root and item.PaginationSemantic—
stylesCSS lines root and item; local values ​​take precedence over provider.PaginationSemantic—
localeNames of buttons, fields and suffix; snake_case aliases are supported.Partial<PaginationLocale>From ConfigProvider

Semantic DOM

Root - nav with an accessible name and a list of ul. items - li with native buttons, the active page is marked aria-current. The border and disabled state buttons are indeed not accessible from the keyboard.

Semantic slots: root refers to nav, item - to li regular pages and transitions. The former prop class refers to ul. ConfigProvider.pagination supports class/style, semantic slots, showSizeChanger and its threshold; local parameters take precedence.

The quick jump field inherits the Input option, and the page size selection inherits Select: closest Form.variant → corresponding component setting → general ConfigProvider.variant → outlined.

itemRender gets ready originalElement and info with onClick, disabled, active and label. If you are replacing originalElement, move the handler and accessible name to your native button.

Registration tokens

Component tokens work through ConfigProvider theme.components.Pagination. The example changes the items size and active color. Shared tokens inherit the topic of the section.

Component tokens
TokenPurpose
itemActiveBgBackground of the active item.
itemActiveBgDisabledBackground of the inaccessible active item.
itemActiveColorText of the active item.
itemActiveColorDisabledInaccessible active text.
itemActiveColorHoverActive text on hover.
itemBgNormal item background.
itemInputBgField background.
itemLinkBgBackground of transition buttons.
itemSizeRegular item size.
itemSizeLGLarge size item.
itemSizeSMSmall size item.
miniOptionsSizeChangerTopShift size changer to mini.
Common tokens of the current topic
TokenCurrent value
colorBgContainer#ffffff
colorBgContainerDisabledrgba(0,0,0,0.04)
colorBgTextActivergba(0,0,0,0.15)
colorBgTextHoverrgba(0,0,0,0.06)
colorBorder#d9d9d9
colorBorderDisabled#d9d9d9
colorFillSecondaryrgba(0,0,0,0.06)
colorFillTertiaryrgba(0,0,0,0.04)
colorPrimary#2f54eb
colorPrimaryBorder#adc6ff
colorPrimaryHover#597ef7
colorTextrgba(0,0,0,0.88)
colorTextDisabledrgba(0,0,0,0.25)
colorTextPlaceholderrgba(0,0,0,0.25)
borderRadius6
borderRadiusLG8
borderRadiusSM4
controlHeightLG40
controlOutlinergba(5,88,255,0.06)
controlOutlineWidth2
fontFamily-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'
fontSize14
fontSizeSM12
fontWeightStrong600
lineHeight1.5714285714285714
lineHeightLG1.5
lineTypesolid
lineWidth1
margin16
marginSM12
marginXS8
marginXXS4
motionDurationMid0.2s
paddingXXS4
screenLG992
screenSM576
sizeLG24

FAQ

How is current different from defaultCurrent?

defaultCurrent sets the initial local value. bind:current allows you to control it externally; pageSize works similarly.

Is recommendPage supported?

No. onChange takes two arguments. Saving the recording position when changing size is designed by the application.

Why doesn't responsive reduce elements?

The ConfigProvider's explicit size or componentSize takes precedence. Even without them, responsive switches the mini class, which in the fixed standard does not guarantee a smaller height. For a fixed result, use size:small.

Why did the quick transition disappear on the phone?

Standard CSS hides the field at a width of up to 576px. The main navigation remains.

Is it possible to change the class prefix?

Yes. Set prefixCls on Pagination or use ConfigProvider.prefixCls for the whole section. Themes, design tokens and styles for individual elements work with either option.