Airframe GitHub Storybook
Component

ba-pagination

This component for navigating large sets of content

Airframe

Active
Figma

Web Components

Active
Storybook GitHub

React

Active
Storybook GitHub

React Native

Planned
Design Code Accessibility QA
A

Previous button

Navigates to the previous page in the set. Hidden when there is no previous page

B

Ellipsis

Indicates a truncated range of pages between the first page and the pages shown around the current page

C

Current page

Highlights the page the user is currently viewing

D

Ellipsis

Indicates a truncated range of pages between the pages shown around the current page and the last page

E

Next button

Navigates to the next page in the set. Hidden when there is no next page

Use when content is split across multiple pages and the user benefits from knowing their position within the full set. For example, search results, data tables, or content listings.Do not use when all items are visible on a single page.

Different variants are shown depending on how many total pages are needed and what page the user is currently on.

Full range

The full range of pages is shown when the total number is 7 pages or less

Full range pagination

Start overflow

Used when there are more than 7 pages and the user is near the beginning of the set. The first four pages are shown, followed by an ellipsis, then the last page. The previous arrow is hidden.

Pagination with overflow for the last pages

Middle overflow

Used when the user is far enough from both ends that truncation is needed on both sides. The first and last pages are always anchored. The current page and one page either side are shown in the centre.

Pagination with overflows either side of the current page

End overflow

The mirror of Overflow start. Used when the user is near the end of the set. The first page is shown, followed by an ellipsis, then the last four pages. The next arrow is hidden.

Pagination with overflow for the start pages

Compact

This version is used on mobile. All pages are contained in the dropdown.

Compact pagination for use on mobile
<ba-pagination
  total="20"
  current="1"
  show-items-per-page
></ba-pagination>
Property Attribute Description Type Default
baseUrl base-url The base url to use for each page link. The page number will be appended to this url as a query parameter, e.g. ?page=2 string | undefined window.location.href
current(required) current The current page number number undefined
currentItemsPerPage current-items-per-page The current number of items per page string | undefined undefined
showItemsPerPage show-items-per-page Whether to show the items per page dropdown boolean | undefined false
total(required) total The total number of pages number undefined
  • None

No slotted content available for this component.

ba-pagination can be slotted into:

Event Description Type
baPaginationLinkClick Emitted when the internal link is clicked. For use with single-page app (SPA) routing so that link clicks can be handled to avoid a full page load. CustomEvent<PaginationLinkClickEventDetail>
baPaginationItemsPerPageChange Emitted when the items per page value has changed. CustomEvent<any>
A basic pagination component showing the user on the first page of a total of 7 pages
<ba-pagination total="20" current="1"></ba-pagination>
A select dropdown with the ability to change how many items per page to show
<ba-pagination total="20" current="1" show-items-per-page></ba-pagination>
baPaginationLinkClick and baPaginationItemsPerPageChange events being used in a single page application
<ba-pagination total="20" current="1" show-items-per-page></ba-pagination>

<script>
  pagination.addEventListener("baPaginationLinkClick", (event) => {
    event.detail.preventDefault();

    // Before custom SPA routing
  });

  pagination.addEventListener("baPaginationItemsPerPageChange", (event) => {
    event.detail.preventDefault();

    // Before custom SPA routing
  });
</script>
Prop Description Type Default
baseUrl The base url to use for each page link. The page number will be appended to this url as a query parameter, e.g. ?page=2 string | undefined window.location.href
current (required) The current page number number undefined
currentItemsPerPage The current number of items per page string | undefined undefined
showItemsPerPage Whether to show the items per page dropdown boolean | undefined false
total (required) The total number of pages number undefined

None

BaPagination can be slotted into:

Event handler Description
onBaPaginationLinkClick Emitted when the internal link is clicked. For use with single-page app (SPA) routing so that link clicks can be handled to avoid a full page load.
onBaPaginationItemsPerPageChange Emitted when the items per page value has changed.
A basic pagination component showing the user on the first page of a total of 7 pages
<BaPagination total={20} current={1}/>
A select dropdown with the ability to change how many items per page to show
<BaPagination total={20} current={1} showItemsPerPage/>

React Native documentation coming soon.

State: Previous element in DOM has focus

⇥ Tab

The previous page button gets focus, or the first page link if there is no previous page

State: Previous page button has focus

⏎ Enter

Navigates to the previous page

⇥ Tab

First visible page link gets focus

State: A page link has focus

⏎ Enter

Navigates to that page, emits baPaginationLinkClick, and updates the current page indicator

⇥ Tab

Next visible page link, or the next page button, gets focus

State: Next page button has focus

⏎ Enter

Navigates to the next page

⇥ Tab

If show-items-per-page is set, the items per page dropdown gets focus, otherwise the next tabbable element outside of the component gets focus

State: Items per page dropdown has focus

␣ Space

Opens the dropdown

↓ Arrow Down

Moves to the next option in the dropdown

↑ Arrow Up

Moves to the previous option in the dropdown

⏎ Enter

Selects the option, closes the dropdown, and emits baPaginationItemsPerPageChange

⇥ Tab

Next tabbable element outside of the component gets focus

Use this checklist to confirm the component has been configured and used correctly.

  • Use ba-pagination when content is split across multiple pages and users benefit from knowing their position within the full set, for example search results, data tables, or content listings
  • Do not use ba-pagination when all items are visible on a single page
  • The full range of pages is shown when the total number is 7 pages or less
  • Start, middle, and end overflow variants are used to truncate page numbers with an ellipsis once there are more than 7 pages, with the first and last page always anchored
  • The compact variant, which shows all pages within a dropdown, is used on mobile
  • The previous button is hidden when there is no previous page, and the next button is hidden when there is no next page
  • The current page is clearly indicated, both visually and to assistive technology
  • Pagination links and controls are operable with keyboard using tab to move focus and enter to activate
  • When used in a single page application, baPaginationLinkClick is handled so that custom routing remains operable without a full page reload

These checks are handled by the component and do not need to be repeated each time it is used.

  • ba-pagination is operable using assistive technology
  • Has a visible focus indicator on all sides of each interactive element
  • Colour contrast for all states in all BAgel themes
  • Animations respect users' reduced motion settings
  • High contrast mode adjustments
Designing Developing Components BAgel helper Web QA React Native QA britishairways.com Careers Cookie policy