React Native MantineNavigation

Pagination

Page navigation with controls

Import: import { Pagination } from 'react-native-mantine';

Usage

import { useState } from 'react';
import { Button, Text, Group } from 'react-native-mantine';

const MyPagination = () => {
  const [page, setPage] = useState(1);
  const totalPages = 10;

  return (
    <>
      <Text>Page {page} of {totalPages}</Text>
      <Group>
        <Button
          onPress={() => setPage(page - 1)}
          disabled={page === 1}
        >
          Previous
        </Button>
        <Button
          onPress={() => setPage(page + 1)}
          disabled={page === totalPages}
        >
          Next
        </Button>
      </Group>
    </>
  );
};

Props

PropTypeDefaultDescription
valuenumberCurrent page (controlled)
defaultValuenumberDefault page (uncontrolled)
onChange(page: number) => voidCalled when page changes
total (required)numberTotal number of pages
sizeMantineSize'md'Pagination size
colorMantineColor'blue'Pagination color
radiusMantineNumberSize'sm'Key of theme.radius or any valid value to set border-radius
siblingsnumber1Number of siblings on each side of selected page
boundariesnumber1Number of elements visible on each side of selected page
withControlsbooleantrueShow previous/next controls
withEdgesbooleanfalseShow first/last controls
disabledbooleanfalseDisabled state
previousIconReact.ReactNodeCustom icon for the previous-page control
nextIconReact.ReactNodeCustom icon for the next-page control
firstIconReact.ReactNodeCustom icon for the first-page control
lastIconReact.ReactNodeCustom icon for the last-page control
styleanyAdditional styles
testIDstringTest identifier used by testing frameworks

Source on GitHub · npm