Pagination
solid-ui/paginationFreeComponent
A pagination component
Live preview
live · rendered by the registry
Rendered by solid-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://www.solid-ui.com/r/pagination.jsonSource
1import type { JSX, ValidComponent } from "solid-js"2import { Show, splitProps } from "solid-js"34import * as PaginationPrimitive from "@kobalte/core/pagination"5import type { PolymorphicProps } from "@kobalte/core/polymorphic"67import { cn } from "~/lib/utils"8import { buttonVariants } from "~/registry/ui/button"910const PaginationItems = PaginationPrimitive.Items1112type PaginationRootProps<T extends ValidComponent = "nav"> =13 PaginationPrimitive.PaginationRootProps<T> & { class?: string | undefined }1415const Pagination = <T extends ValidComponent = "nav">(16 props: PolymorphicProps<T, PaginationRootProps<T>>17) => {18 const [local, others] = splitProps(props as PaginationRootProps, ["class"])19 return (20 <PaginationPrimitive.Root21 class={cn("[&>*]:flex [&>*]:flex-row [&>*]:items-center [&>*]:gap-1", local.class)}22 {...others}23 />24 )25}2627type PaginationItemProps<T extends ValidComponent = "button"> =28 PaginationPrimitive.PaginationItemProps<T> & { class?: string | undefined }2930const PaginationItem = <T extends ValidComponent = "button">(31 props: PolymorphicProps<T, PaginationItemProps<T>>32) => {33 const [local, others] = splitProps(props as PaginationItemProps, ["class"])34 return (35 <PaginationPrimitive.Item36 class={cn(37 buttonVariants({38 variant: "ghost"39 }),40 "size-10 data-[current]:border",41 local.class42 )}43 {...others}44 />45 )46}4748type PaginationEllipsisProps<T extends ValidComponent = "div"> =49 PaginationPrimitive.PaginationEllipsisProps<T> & {50 class?: string | undefined51 }5253const PaginationEllipsis = <T extends ValidComponent = "div">(54 props: PolymorphicProps<T, PaginationEllipsisProps<T>>55) => {56 const [local, others] = splitProps(props as PaginationEllipsisProps, ["class"])57 return (58 <PaginationPrimitive.Ellipsis59 class={cn("flex size-10 items-center justify-center", local.class)}60 {...others}61 >62 <svg63 xmlns="http://www.w3.org/2000/svg"64 viewBox="0 0 24 24"65 fill="none"66 stroke="currentColor"67 stroke-width="2"68 stroke-linecap="round"69 stroke-linejoin="round"70 class="size-4"71 >72 <circle cx="12" cy="12" r="1" />73 <circle cx="19" cy="12" r="1" />74 <circle cx="5" cy="12" r="1" />75 </svg>76 <span class="sr-only">More pages</span>77 </PaginationPrimitive.Ellipsis>78 )79}8081type PaginationPreviousProps<T extends ValidComponent = "button"> =82// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from solid-ui
All 55 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | solid-ui | Components | Free | 2 deps | |
| Alertalert | solid-ui | Components | Free | 3 deps | |
| Alert Dialogalert-dialog | solid-ui | Components | Free | 2 deps | |
| Aspect Ratioaspect-ratio | solid-ui | Components | Free | 1 dep | |
| Avataravatar | solid-ui | Components | Free | 2 deps | |
| Badgebadge | solid-ui | Components | Free | 2 deps | |
| Badge Deltabadge-delta | solid-ui | Components | Free | 2 deps | |
| Bar Listbar-list | solid-ui | Components | Free | 1 dep |
