Skip to main content

Pagination

Overview​

The Pagination component provides a flexible, composable Bulma pagination navigation for your Bulma React UI.

It supports size, alignment, rounded corners, disabled states, and both controlled and uncontrolled usage. Use the provided subcomponents to build complex paginations: previous/next buttons, page links, ellipsis, and custom content. (The color prop is deprecated on the root, where Bulma ships no pagination color CSS, so it has never had a visual effect, and on Pagination.List and Pagination.Link, where it renders the text color helper in place of textColor.)

info

Use Pagination for navigating lists of results, pages, or any content split across screens.


Import​

import { Pagination } from '@allxsmith/bestax-bulma';

Usage​

Basic Pagination​

This example demonstrates a basic pagination navigation using Pagination, Pagination.List, and Pagination.Link subcomponents. The active prop highlights the current page, while previous/next arrows and an ellipsis provide navigation for larger sets. Adjust the structure to match your data set or navigation needs.

<Pagination>
  <Pagination.List>
    <Pagination.Link href="#previous" aria-label="Previous page">
      &laquo;
    </Pagination.Link>
    <Pagination.Link active href="#page-1">
      1
    </Pagination.Link>
    <Pagination.Link href="#page-2">2</Pagination.Link>
    <Pagination.Link href="#page-3">3</Pagination.Link>
    <Pagination.Ellipsis />
    <Pagination.Link href="#page-10">10</Pagination.Link>
    <Pagination.Link href="#next" aria-label="Next page">
      &raquo;
    </Pagination.Link>
  </Pagination.List>
</Pagination>


Sizes​

Showcases the use of the size prop to render paginations in different sizes. Set size="small", size="medium", or size="large" to match the pagination to your UI scale. Each instance below demonstrates a different size, with the active prop indicating the current page.

<>
  <Pagination size="small" mb="2">
    <Pagination.List>
      <Pagination.Link href="#page-1">1</Pagination.Link>
      <Pagination.Link active href="#page-2">
        2
      </Pagination.Link>
      <Pagination.Link href="#page-3">3</Pagination.Link>
    </Pagination.List>
  </Pagination>
  <Pagination size="medium" mb="2">
    <Pagination.List>
      <Pagination.Link href="#page-1">1</Pagination.Link>
      <Pagination.Link active href="#page-2">
        2
      </Pagination.Link>
      <Pagination.Link href="#page-3">3</Pagination.Link>
    </Pagination.List>
  </Pagination>
  <Pagination size="large">
    <Pagination.List>
      <Pagination.Link href="#page-1">1</Pagination.Link>
      <Pagination.Link active href="#page-2">
        2
      </Pagination.Link>
      <Pagination.Link href="#page-3">3</Pagination.Link>
    </Pagination.List>
  </Pagination>
</>


Alignment​

Demonstrates the align prop to control the pagination alignment. Use align="centered" to center the pagination, or align="right" to align it to the right. This affects the entire pagination component, including the list of links and any additional content.

<>
  <Pagination align="centered" mb="2">
    <Pagination.List>
      <Pagination.Link href="#page-1">1</Pagination.Link>
      <Pagination.Link active href="#page-2">
        2
      </Pagination.Link>
      <Pagination.Link href="#page-3">3</Pagination.Link>
    </Pagination.List>
  </Pagination>
  <Pagination align="right">
    <Pagination.List>
      <Pagination.Link href="#page-1">1</Pagination.Link>
      <Pagination.Link active href="#page-2">
        2
      </Pagination.Link>
      <Pagination.Link href="#page-3">3</Pagination.Link>
    </Pagination.List>
  </Pagination>
</>


Rounded​

This example demonstrates the rounded prop, which renders the pagination with rounded corners for a softer, modern look. Use rounded to visually distinguish pagination controls or match your app's design language.

<Pagination rounded>
  <Pagination.List>
    <Pagination.Link href="#page-1">1</Pagination.Link>
    <Pagination.Link active href="#page-2">
      2
    </Pagination.Link>
    <Pagination.Link href="#page-3">3</Pagination.Link>
  </Pagination.List>
</Pagination>


With Disabled​

This example shows how to use the disabled prop on Pagination.Link to indicate unavailable navigation options. Here, the first link is disabled, preventing user interaction. Use disabled for links that should not be clickable, such as when on the first or last page.

<Pagination>
  <Pagination.List>
    <Pagination.Link disabled aria-label="Previous page">
      &laquo;
    </Pagination.Link>
    <Pagination.Link active href="#page-1">
      1
    </Pagination.Link>
    <Pagination.Link href="#page-2">2</Pagination.Link>
    <Pagination.Link href="#page-3">3</Pagination.Link>
    <Pagination.Ellipsis />
    <Pagination.Link href="#page-10">10</Pagination.Link>
    <Pagination.Link href="#next" aria-label="Next page">
      &raquo;
    </Pagination.Link>
  </Pagination.List>
</Pagination>


Controlled Pagination​

This example demonstrates a controlled pagination pattern using the page state and the onClick handler on each Pagination.Link. The current page is tracked in state, and clicking a link updates the page. With no href, each part is a button, so Enter and Space choose a page too. Use this approach for paginations where you need to manage the current page in your app logic.

function example() {
  const [page, setPage] = useState(1);
  return (
    <>
      <Pagination>
        <Pagination.Previous
          disabled={page === 1}
          onClick={() => setPage(page - 1)}
        >
          Previous
        </Pagination.Previous>
        <Pagination.Next
          disabled={page === 5}
          onClick={() => setPage(page + 1)}
        >
          Next
        </Pagination.Next>
        <Pagination.List>
          {[1, 2, 3, 4, 5].map(i => (
            <Pagination.Link
              key={i}
              active={i === page}
              onClick={() => setPage(i)}
            >
              {i}
            </Pagination.Link>
          ))}
        </Pagination.List>
      </Pagination>
      <Paragraph mt="2">Current page: {page}</Paragraph>
    </>
  );
}


From a Page Count​

Give Pagination a total and no children, and it renders the whole control itself: Previous, Next and a link for each page it shows, with an ellipsis where it skips a run of pages. current and onPageChange make it controlled; leave current out and it keeps the page itself. siblingCount sets how many pages show on each side of the current one, and boundaryCount how many always show at each end, and the row keeps its length as the page moves. Pass getPageHref to make each page a real link, for URLs like ?page=3. With children, Pagination renders those instead, as in the examples above.

function example() {
  const [page, setPage] = useState(10);
  return (
    <>
      <Pagination total={20} current={page} onPageChange={setPage} />
      <Paragraph mt="2">Current page: {page}</Paragraph>
    </>
  );
}


Previous/Next with Pagination List​

This example combines the Pagination.Previous and Pagination.Next subcomponents with a Pagination.List for a more advanced navigation pattern. Use Previous and Next for clear navigation controls, and combine with Pagination.Link and Pagination.Ellipsis for complex paginations.

<Pagination align="centered">
  <Pagination.Previous href="#previous">Previous</Pagination.Previous>
  <Pagination.Next href="#next">Next page</Pagination.Next>
  <Pagination.List>
    <Pagination.Link aria-label="Goto page 1" href="#page-1">
      1
    </Pagination.Link>
    <Pagination.Ellipsis />
    <Pagination.Link aria-label="Goto page 45" href="#page-45">
      45
    </Pagination.Link>
    <Pagination.Link active aria-label="Page 46" href="#page-46">
      46
    </Pagination.Link>
    <Pagination.Link aria-label="Goto page 47" href="#page-47">
      47
    </Pagination.Link>
    <Pagination.Ellipsis />
    <Pagination.Link aria-label="Goto page 86" href="#page-86">
      86
    </Pagination.Link>
  </Pagination.List>
</Pagination>


Compound (dot-notation) usage​

Every subcomponent is exported by name (PaginationLink, PaginationList, …) and attached to Pagination as a static, so a full pagination can be composed from the single Pagination import.

<Pagination>
  <Pagination.Previous href="#previous">Previous</Pagination.Previous>
  <Pagination.Next href="#next">Next page</Pagination.Next>
  <Pagination.List>
    <Pagination.Link active href="#page-1">
      1
    </Pagination.Link>
    <Pagination.Link href="#page-2">2</Pagination.Link>
    <Pagination.Ellipsis />
    <Pagination.Link href="#page-10">10</Pagination.Link>
  </Pagination.List>
</Pagination>


Accessibility​

  • The root Pagination renders as a semantic <nav role="navigation" aria-label="pagination">.
  • Use aria-label on page links for better screen reader support.
  • Disabled and active states are handled with ARIA attributes and classes.
  • Rendered from total, each page's link is named for its page ("Page 3"; pass getPageLabel for your own words), and the current page's link carries aria-current="page". Without getPageHref the links have no href, so they carry role="button" and choose a page with Enter or Space. With it, an end that goes nowhere has no href either, so it's a disabled button.
  • Links and buttons: Pagination.Link, Pagination.Previous and Pagination.Next render an <a>. Given an href, it's a link, and the browser follows it. Without one it's a button: it carries role="button", and Enter or Space clicks it, so an onClick works from the keyboard too, as in Controlled Pagination. A disabled one does nothing, a role you pass wins, and an onKeyDown you pass keeps the keys to itself.
  • Focus ring: the previous, next and page links show a focus ring for keyboard focus only, in Bulma's focus color, width, style and offset (--bulma-focus-h, --bulma-focus-s, --bulma-focus-l, --bulma-focus-width, --bulma-focus-style, --bulma-focus-offset). The current page is filled with the link color, which matches the focus color by default, so its ring takes the link's text color instead, inside the fill. It comes from the bestax extras (extras.css, or bestax.css, which includes them); with Bulma's CSS alone a focused link shows only its hover shade.
  • Forced colors: Bulma marks the current page with colors alone, which forced colors (Windows' contrast themes) replaces, so bestax's styles draw it in the system's highlight colors there instead. A link with Bulma's is-current or is-selected class gets them, so a DataTable's pager does too. A disabled control, such as Previous at the first page or a Pagination.Link with disabled, is drawn there in the system's color for a disabled control at full strength, since Bulma's half opacity would only fade it, and a disabled current page is filled with that color.
note

Pagination's parts render <a> elements: links with an href, and buttons without one.


  • Helper Props: Bulma helper props for spacing and other utilities.
  • Button: For custom page controls if needed.

Additional Resources​

Pro Tip

You can use Bulma helper props with <Pagination />, Pagination.List and Pagination.Link for utility-based styling.


Props​

PropTypeDefaultDescription
color'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger' | 'black' | 'dark' | 'light' | 'white'—Deprecated. No .pagination.is-<color> CSS exists; the prop renders unstyled and will be removed in the next major version. Color modifier for the pagination (renders is-<color>). Bulma ships no pagination color CSS, so this prop has never had a visual effect for any value. Passing it logs a console warning in development. Use textColor / bgColor instead.
textColorBulma color | 'inherit' | 'current'—Text color helper.
bgColorBulma color | 'inherit' | 'current'—Background color helper.
size'small' | 'medium' | 'large'—Size modifier for the pagination.
align'centered' | 'right'—Alignment for the pagination.
roundedbooleanfalseRenders pagination with rounded corners.
totalnumber—The number of pages. Given total and no children, Pagination renders the whole control itself: Previous, Next and a link for each page it shows, with an ellipsis where it skips some. Given children, it renders those as they are, and total and the other page props do nothing.
currentnumber—The page shown as current, counting from 1, when rendering from total. Leave it out and Pagination keeps the page itself, starting at 1.
onPageChange(page: number) => void—Called with the page chosen, when rendering from total. Choosing the page already current doesn't call it.
siblingCountnumber1How many pages to show on each side of the current one, when rendering from total.
boundaryCountnumber1How many pages to always show at the start and at the end, when rendering from total.
previousLabelReact.ReactNode'Previous'The Previous link's content, when rendering from total.
nextLabelReact.ReactNode'Next'The Next link's content, when rendering from total.
disabledbooleanfalseDisables every link, when rendering from total.
getPageHref(page: number) => string—The href for a page's link, when rendering from total, making each one a real link (page => '?page=' + page). A click then calls onPageChange and the browser follows the link too. Without it the links have no href, act as buttons, and Enter or Space chooses a page. An end that goes nowhere, Previous on the first page and Next on the last, has no href either way, so it's a disabled button.
getPageLabel(page: number) => string—The accessible name of a page's link, when rendering from total, since its content is only the number (page => 'Page ' + page by default). Inside a LocaleProvider with a locale, the number on the link, and in the default name, is written the way that locale writes numbers, so the name still holds the text on screen.
classNamestring—Additional CSS classes.
childrenReact.ReactNode—Custom pagination content (usually subcomponents).
...All standard HTML attributes and Bulma helper props—See Helper Props

Subcomponents:

  • Pagination.Link: Page number or navigation link.
  • Pagination.List: Container for page links and ellipsis.
  • Pagination.Ellipsis: Ellipsis separator.
  • Pagination.Previous: "Previous" navigation button.
  • Pagination.Next: "Next" navigation button.
PropTypeDefaultDescription
classNamestring—Additional CSS classes.
color'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'—Deprecated. Use textColor instead. This prop will be removed in the next major version. Renders the text color helper (has-text-<color>), not a modifier: Bulma ships no pagination link color CSS. It takes the place of textColor, which renders nothing while this prop is present, even as undefined. Passing it logs a console warning in development.
textColorBulma color | 'inherit' | 'current'—Text color. It renders nothing while a color prop is present, even an undefined one.
bgColorBulma color | 'inherit' | 'current'—Background color.
activebooleanfalseWhether the link is for the current page.
disabledbooleanfalseWhether the link is disabled.
childrenReact.ReactNode—Link content.
hrefstring—Where the link goes. Without one it's a button: it renders role="button", and Enter or Space clicks it, so its onClick runs from the keyboard too. A role you pass wins, and an onKeyDown you pass keeps the keys to itself.
...All standard <a> attributes and Bulma helper props—See Helper Props

Pagination.List​

PropTypeDefaultDescription
classNamestring—Additional CSS classes.
textColorBulma color | 'inherit' | 'current'—Text color for the list. It renders nothing while a color prop is present, even an undefined one.
color'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'—Deprecated. Use textColor instead. This prop will be removed in the next major version. Renders the text color helper (has-text-<color>), not a modifier: Bulma ships no pagination list color CSS. It takes the place of textColor, which renders nothing while this prop is present, even as undefined. Passing it logs a console warning in development.
bgColorBulma color | 'inherit' | 'current'—Background color for the list.
childrenReact.ReactNode—List items.
...All standard <ul> attributes and Bulma helper props—See Helper Props

Pagination.Ellipsis​

PropTypeDefaultDescription
classNamestring—Additional CSS classes, added to the ellipsis's own pagination-ellipsis class on its <span>. The part's other attributes go on the <span> too, though they're typed as the <li>'s.
...All standard <li> attributes—

Pagination.Previous​

PropTypeDefaultDescription
classNamestring—Additional CSS classes.
disabledbooleanfalseWhether previous/next is disabled.
childrenReact.ReactNode—Button content.
hrefstring—Where the link goes. Without one it's a button: it renders role="button", and Enter or Space clicks it, so its onClick runs from the keyboard too. A role you pass wins, and an onKeyDown you pass keeps the keys to itself.
...All standard <a> attributes—

Pagination.Next​

PropTypeDefaultDescription
classNamestring—Additional CSS classes.
disabledbooleanfalseWhether previous/next is disabled.
childrenReact.ReactNode—Button content.
hrefstring—Where the link goes. Without one it's a button: it renders role="button", and Enter or Space clicks it, so its onClick runs from the keyboard too. A role you pass wins, and an onKeyDown you pass keeps the keys to itself.
...All standard <a> attributes—

CSS & Sass Variables​

Pagination registers these variables on its own .pagination element. Override them there (or via className) — a value set on an ancestor is only inherited, and loses to the component-level declaration. See Theme.

CSS VariableSass VariableDefault
--bulma-pagination-margin$pagination-margin-0.25rem
--bulma-pagination-min-width$pagination-min-widthvar(--bulma-control-height)
--bulma-pagination-item-h$pagination-item-hvar(--bulma-scheme-h)
--bulma-pagination-item-s$pagination-item-svar(--bulma-scheme-s)
--bulma-pagination-item-l$pagination-item-lvar(--bulma-scheme-main-l)
--bulma-pagination-item-background-l-delta$pagination-item-background-l-delta0%
--bulma-pagination-item-hover-background-l-delta$pagination-item-hover-background-l-deltavar(--bulma-hover-background-l-delta)
--bulma-pagination-item-active-background-l-delta$pagination-item-active-background-l-deltavar(--bulma-active-background-l-delta)
--bulma-pagination-item-border-style$pagination-item-border-stylesolid
--bulma-pagination-item-border-width$pagination-item-border-widthvar(--bulma-control-border-width)
--bulma-pagination-item-border-l$pagination-item-border-lvar(--bulma-border-l)
--bulma-pagination-item-border-l-delta$pagination-item-border-l-delta0%
--bulma-pagination-item-hover-border-l-delta$pagination-item-hover-border-l-deltavar(--bulma-hover-border-l-delta)
--bulma-pagination-item-active-border-l-delta$pagination-item-active-border-l-deltavar(--bulma-active-border-l-delta)
--bulma-pagination-item-focus-border-l-delta$pagination-item-focus-border-l-deltavar(--bulma-focus-border-l-delta)
--bulma-pagination-item-color-l$pagination-item-color-lvar(--bulma-text-strong-l)
--bulma-pagination-item-font-size$pagination-item-font-size1em
--bulma-pagination-item-margin$pagination-item-margin0.25rem
--bulma-pagination-item-padding-left$pagination-item-padding-left0.5em
--bulma-pagination-item-padding-right$pagination-item-padding-right0.5em
--bulma-pagination-item-outer-shadow-h$pagination-item-outer-shadow-h0
--bulma-pagination-item-outer-shadow-s$pagination-item-outer-shadow-s0%
--bulma-pagination-item-outer-shadow-l$pagination-item-outer-shadow-l20%
--bulma-pagination-item-outer-shadow-a$pagination-item-outer-shadow-a0.05
--bulma-pagination-nav-padding-left$pagination-nav-padding-left0.75em
--bulma-pagination-nav-padding-right$pagination-nav-padding-right0.75em
--bulma-pagination-disabled-color$pagination-disabled-colorvar(--bulma-text-weak)
--bulma-pagination-disabled-background-color$pagination-disabled-background-colorvar(--bulma-border)
--bulma-pagination-disabled-border-color$pagination-disabled-border-colorvar(--bulma-border)
--bulma-pagination-current-color$pagination-current-colorvar(--bulma-link-invert)
--bulma-pagination-current-background-color$pagination-current-background-colorvar(--bulma-link)
--bulma-pagination-current-border-color$pagination-current-border-colorvar(--bulma-link)
--bulma-pagination-ellipsis-color$pagination-ellipsis-colorvar(--bulma-text-weak)
--bulma-pagination-shadow-inset$pagination-shadow-insetinset 0 0.0625em 0.125em hsla(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-scheme-invert-l), 0.2)
--bulma-pagination-selected-item-h$pagination-selected-item-hvar(--bulma-link-h)
--bulma-pagination-selected-item-s$pagination-selected-item-svar(--bulma-link-s)
--bulma-pagination-selected-item-l$pagination-selected-item-lvar(--bulma-link-l)
--bulma-pagination-selected-item-background-l$pagination-selected-item-background-lvar(--bulma-link-l)
--bulma-pagination-selected-item-border-l$pagination-selected-item-border-lvar(--bulma-link-l)
--bulma-pagination-selected-item-color-l$pagination-selected-item-color-lvar(--bulma-link-invert-l)