createPagination

function

createPagination(config?): PaginationWidget

Create a PaginationWidget with given config props

Parameters

config?: PropsConfig<PaginationProps>

an optional pagination config

Returns

PaginationWidget

a PaginationWidget


DirectionsHrefs

interface
Properties
next

next: string

The href for the 'Next' direction link


previous

previous: string

The href for the 'Previous' navigation link


getPaginationDefaultConfig

function

getPaginationDefaultConfig(): object

Returns a shallow copy of the default pagination config

Returns

object

a copy of the default config

activeLabel

activeLabel: string

The label for the "active" page. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'(current)'
ariaEllipsisLabel

ariaEllipsisLabel: string

The label for the "Ellipsis" page. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'Ellipsis page element'

ariaFirstLabel

ariaFirstLabel: string

The label for the "First" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for first page'
ariaLabel

ariaLabel: string

The label for the nav element.

for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'Page navigation'

ariaLastLabel

ariaLastLabel: string

The label for the "Last" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for last page'
ariaLiveLabel

ariaLiveLabel: (currentPage, pageCount) => string

Provide the label for the aria-live element This is used for accessibility purposes. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Parameters

currentPage: number

The current page number

pageCount: number

The total number of pages

Returns

string

Default Value
(currentPage: number, pageCount: number) => `Current page is ${currentPage}`
ariaNextLabel

ariaNextLabel: string

The label for the "Next" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for next page'
ariaPageLabel

ariaPageLabel: (processPage, pageCount) => string

Provide the label for each "Page" page button. This is used for accessibility purposes. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Parameters

processPage: number

The current page number

pageCount: number

The total number of pages

Returns

string

Default Value
(processPage: number, pageCount: number) => `Page ${processPage} of ${pageCount}`
ariaPreviousLabel

ariaPreviousLabel: string

The label for the "Previous" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for previous page'

boundaryLinks: boolean

If true, the "First" and "Last" page links are shown.

Default Value

false

className

className: string

CSS classes to be applied on the widget main container

Default Value

''

collectionSize

collectionSize: number

The number of items in your paginated collection.

Note, that this is not the number of pages. Page numbers are calculated dynamically based on collectionSize and pageSize.

Ex. if you have 100 items in your collection and displaying 20 items per page, you'll end up with 5 pages.

Whatever the collectionSize the page number is of minimum 1.

Default Value

0

directionLinks: boolean

If true, the "Next" and "Previous" page links are shown.

Default Value

true

disabled

disabled: boolean

If true, pagination links will be disabled.

Default Value

false

onPageChange

onPageChange: (page) => void

An event fired when the page is changed.

Event payload is the number of the newly selected page.

Page numbers start with 1.

Parameters

page: number

Returns

void

Default Value
() => {}
page

page: number

The current page.

Page numbers start with 1.

Default Value

1

pageLink: (pageNumber) => string

Factory function providing the href for a "Page" page anchor, based on the current page number

Parameters

pageNumber: number

The index to use in the link

Returns

string

Default Value
(_page: number) => PAGE_LINK_DEFAULT
pageSize

pageSize: number

The number of items per page.

Remarks

min value is 1

Default Value

10

pagesFactory

pagesFactory: (page, pageCount) => number[]

pagesFactory returns a function computing the array of pages to be displayed as number (-1 are treated as ellipsis). Use Page slot to customize the pages view and not this

Parameters

page: number

The current page number

pageCount: number

The total number of pages

Returns

number[]

Default Value
(_page: number, pageCount: number) => {
        const pages: number[] = [];
        for (let i = 1; i <= pageCount; i++) {
            pages.push(i);
        }
        return pages;
    }
size

size: null | "sm" | "lg"

The pagination display size.

Bootstrap currently supports small and large sizes.

Default Value

null


PaginationActions

interface
Methods
first

first(event?): void

To "go" to the first page

Parameters

event?: MouseEvent

Returns

void


last

last(event?): void

To "go" to the last page

Parameters

event?: MouseEvent

Returns

void


next

next(event?): void

To "go" to the next page

Parameters

event?: MouseEvent

Returns

void


previous

previous(event?): void

To "go" to the previous page

Parameters

event?: MouseEvent

Returns

void


select

select(page, event?): void

To "go" to a specific page

Parameters

page: number

The page number to select

event?: MouseEvent

Returns

void


PaginationApi

interface

PaginationDirectives

interface
Properties
pageFirst

pageFirst: Directive

A directive to be applied on the first link


pageLast

pageLast: Directive

A directive to be applied on the Last link


pageLink: Directive<object>

A directive to be applied to each page link This will handle the click, tabindex and aria attributes

Type declaration
page

page: number


pageNext

pageNext: Directive

A directive to be applied on the next link


pagePrev

pagePrev: Directive

A directive to be applied on the previous link


PaginationProps

interface
Properties
activeLabel

activeLabel: string

The label for the "active" page. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'(current)'

ariaEllipsisLabel

ariaEllipsisLabel: string

The label for the "Ellipsis" page. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'Ellipsis page element'


ariaFirstLabel

ariaFirstLabel: string

The label for the "First" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for first page'

ariaLabel

ariaLabel: string

The label for the nav element.

for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'Page navigation'


ariaLastLabel

ariaLastLabel: string

The label for the "Last" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for last page'

ariaLiveLabel

ariaLiveLabel: (currentPage, pageCount) => string

Provide the label for the aria-live element This is used for accessibility purposes. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Parameters

currentPage: number

The current page number

pageCount: number

The total number of pages

Returns

string

Default Value
(currentPage: number, pageCount: number) => `Current page is ${currentPage}`

ariaNextLabel

ariaNextLabel: string

The label for the "Next" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for next page'

ariaPageLabel

ariaPageLabel: (processPage, pageCount) => string

Provide the label for each "Page" page button. This is used for accessibility purposes. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Parameters

processPage: number

The current page number

pageCount: number

The total number of pages

Returns

string

Default Value
(processPage: number, pageCount: number) => `Page ${processPage} of ${pageCount}`

ariaPreviousLabel

ariaPreviousLabel: string

The label for the "Previous" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for previous page'

boundaryLinks: boolean

If true, the "First" and "Last" page links are shown.

Default Value

false


className

className: string

CSS classes to be applied on the widget main container

Default Value

''


collectionSize

collectionSize: number

The number of items in your paginated collection.

Note, that this is not the number of pages. Page numbers are calculated dynamically based on collectionSize and pageSize.

Ex. if you have 100 items in your collection and displaying 20 items per page, you'll end up with 5 pages.

Whatever the collectionSize the page number is of minimum 1.

Default Value

0


directionLinks: boolean

If true, the "Next" and "Previous" page links are shown.

Default Value

true


disabled

disabled: boolean

If true, pagination links will be disabled.

Default Value

false


onPageChange

onPageChange: (page) => void

An event fired when the page is changed.

Event payload is the number of the newly selected page.

Page numbers start with 1.

Parameters

page: number

Returns

void

Default Value
() => {}

page

page: number

The current page.

Page numbers start with 1.

Default Value

1


pageLink: (pageNumber) => string

Factory function providing the href for a "Page" page anchor, based on the current page number

Parameters

pageNumber: number

The index to use in the link

Returns

string

Default Value
(_page: number) => PAGE_LINK_DEFAULT

pageSize

pageSize: number

The number of items per page.

Remarks

min value is 1

Default Value

10


pagesFactory

pagesFactory: (page, pageCount) => number[]

pagesFactory returns a function computing the array of pages to be displayed as number (-1 are treated as ellipsis). Use Page slot to customize the pages view and not this

Parameters

page: number

The current page number

pageCount: number

The total number of pages

Returns

number[]

Default Value
(_page: number, pageCount: number) => {
        const pages: number[] = [];
        for (let i = 1; i <= pageCount; i++) {
            pages.push(i);
        }
        return pages;
    }

size

size: null | "sm" | "lg"

The pagination display size.

Bootstrap currently supports small and large sizes.

Default Value

null


PaginationState

interface
Properties
activeLabel

activeLabel: string

The label for the "active" page. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'(current)'

ariaEllipsisLabel

ariaEllipsisLabel: string

The label for the "Ellipsis" page. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'Ellipsis page element'


ariaFirstLabel

ariaFirstLabel: string

The label for the "First" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for first page'

ariaLabel

ariaLabel: string

The label for the nav element.

for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'Page navigation'


ariaLastLabel

ariaLastLabel: string

The label for the "Last" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for last page'

ariaLiveLabelText

ariaLiveLabelText: string

The aria-live text


ariaNextLabel

ariaNextLabel: string

The label for the "Next" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for next page'

ariaPreviousLabel

ariaPreviousLabel: string

The label for the "Previous" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for previous page'

boundaryLinks: boolean

If true, the "First" and "Last" page links are shown.

Default Value

false


className

className: string

CSS classes to be applied on the widget main container

Default Value

''


directionLinks: boolean

If true, the "Next" and "Previous" page links are shown.

Default Value

true


directionsHrefs

directionsHrefs: DirectionsHrefs

The hrefs for the direction links


disabled

disabled: boolean

If true, pagination links will be disabled.

Default Value

false


nextDisabled

nextDisabled: boolean

true if the next link need to be disabled


page

page: number

The current page.

Page numbers start with 1.

Default Value

1


pageCount

pageCount: number

The number of pages.


pages

pages: number[]

The current pages, the number in the Array is the number of the page.


pagesHrefs

pagesHrefs: string[]

The hrefs for each "Page" page link


pagesLabel

pagesLabel: string[]

The label for each "Page" page link.


previousDisabled

previousDisabled: boolean

true if the previous link need to be disabled


size

size: null | "sm" | "lg"

The pagination display size.

Bootstrap currently supports small and large sizes.

Default Value

null


PaginationWidget

type alias

PaginationWidget: Widget<PaginationProps, PaginationState, PaginationApi, PaginationActions, PaginationDirectives>