React Native Mantine › Navigation
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
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | Current page (controlled) | |
defaultValue | number | Default page (uncontrolled) | |
onChange | (page: number) => void | Called when page changes | |
total (required) | number | Total number of pages | |
size | MantineSize | 'md' | Pagination size |
color | MantineColor | 'blue' | Pagination color |
radius | MantineNumberSize | 'sm' | Key of theme.radius or any valid value to set border-radius |
siblings | number | 1 | Number of siblings on each side of selected page |
boundaries | number | 1 | Number of elements visible on each side of selected page |
withControls | boolean | true | Show previous/next controls |
withEdges | boolean | false | Show first/last controls |
disabled | boolean | false | Disabled state |
previousIcon | React.ReactNode | Custom icon for the previous-page control | |
nextIcon | React.ReactNode | Custom icon for the next-page control | |
firstIcon | React.ReactNode | Custom icon for the first-page control | |
lastIcon | React.ReactNode | Custom icon for the last-page control | |
style | any | Additional styles | |
testID | string | Test identifier used by testing frameworks |