ReScript Shadcn
Get started
  • Installation
Components
  • Accordion
  • Alert
  • AlertDialog
  • AspectRatio
  • Attachment
  • Avatar
  • Badge
  • Breadcrumb
  • Bubble
  • Button
  • ButtonGroup
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Collapsible
  • Combobox
  • Command
  • ContextMenu
  • DataTable
  • DatePicker
  • Dialog
  • Direction
  • Drawer
  • DropdownMenu
  • Empty
  • Field
  • HoverCard
  • Input
  • InputGroup
  • InputOtp
  • Item
  • Kbd
  • Label
  • Marker
  • Menubar
  • Message
  • MessageScroller
  • NativeSelect
  • NavigationMenu
  • Pagination
  • Popover
  • Progress
  • RadioGroup
  • Resizable
  • ScrollArea
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Skeleton
  • Slider
  • Sonner
  • Spinner
  • Switch
  • Table
  • Tabs
  • Textarea
  • Toast
  • Toggle
  • ToggleGroup
  • Tooltip
  • Typography

Pagination

Pagination with page navigation, next and previous links.

  • Previous
  • 1
  • 2
  • 3
  • More pages
  • Next

Installation#

npx shadcn@latest add @rescript-shadcn/Pagination

Usage#

<Pagination>
  <Pagination.Content>
    <Pagination.Item>
      <Pagination.Previous href="#" />
    </Pagination.Item>
    <Pagination.Item>
      <Pagination.Link href="#"> {"1"->React.string} </Pagination.Link>
    </Pagination.Item>
    <Pagination.Item>
      <Pagination.Link href="#" isActive=true> {"2"->React.string} </Pagination.Link>
    </Pagination.Item>
    <Pagination.Item>
      <Pagination.Link href="#"> {"3"->React.string} </Pagination.Link>
    </Pagination.Item>
    <Pagination.Item>
      <Pagination.Ellipsis />
    </Pagination.Item>
    <Pagination.Item>
      <Pagination.Next href="#" />
    </Pagination.Item>
  </Pagination.Content>
</Pagination>

Examples#

Simple#

A simple pagination with only page numbers.

  • 1
  • 2
  • 3
  • 4
  • 5

Icons Only#

Use just the previous and next buttons without page numbers. This is useful for data tables with a rows per page selector.

  • Previous
  • Next

Next.js#

By default the <Pagination.Link /> component will render an <a /> tag.

To use the Next.js <Link /> component, make the following updates to Pagination.res.

 
module Link = (...) => 
  <Item>
-   <a>
+   <Link>
      // ...
-   </a>
+   </Link>
  </Item>
 
 

Note: We are making updates to the cli to automatically do this for you.

@react.component
let make = () =>
  <Pagination>
@react.component
let make = () =>
  <Pagination>
@react.component
let make = () =>
  <div className="flex items-center justify-between gap-4">