# Pagination Documentation for the Pagination component. ## Installation ```bash deno run -A jsr:@lockness/ui add pagination ``` ## Usage ```tsx import { Pagination } from '@lockness/ui/components' ``` ## Props ### Pagination | Prop | Type | Default | Description | | ------------- | --------- | ------------ | ------------------------------------------------------------ | | currentPage | `number` | **required** | Current page number (1-indexed) | | totalPages | `number` | **required** | Total number of pages | | baseUrl | `string` | **required** | Base URL for pagination links (page number will be appended) | | pageParam | `string` | `'page'` | Query parameter name for page | | siblingCount | `number` | - | Number of page numbers to show around current page | | showFirstLast | `boolean` | - | Show first/last page buttons | | class | `string` | - | Additional CSS classes | | up-target | `string` | - | Unpoly target selector | | up-preload | `boolean` | - | Enable Unpoly preload on hover | | up-transition | `string` | - | Unpoly transition | ### PaginationItem | Prop | Type | Default | Description | | ------------- | --------- | ------- | ---------------------- | | href | `string` | - | Link href | | isActive | `boolean` | `false` | Is current page | | disabled | `boolean` | `false` | Is disabled | | class | `string` | - | Additional CSS classes | | children | `unknown` | - | Item content | | up-target | `string` | - | Unpoly target selector | | up-preload | `boolean` | - | Enable Unpoly preload | | up-transition | `string` | - | Unpoly transition | ## Theming The Pagination component can be customized using CSS variables. This allows you to change the appearance of pagination globally or override specific instances. ### Available CSS Variables | Variable | Default | Description | | ------------------------------------- | --------------------------- | ---------------------------------------- | | `--pagination-gap` | `0.25rem` | Gap between pagination items | | `--pagination-item-size` | `2.5rem` | Width and height of pagination items | | `--pagination-item-font-size` | `0.875rem` | Font size for pagination items | | `--pagination-item-border-radius` | `var(--radius)` | Border radius for pagination items | | `--pagination-item-background` | `var(--background)` | Background color for pagination items | | `--pagination-item-background-hover` | `var(--accent)` | Background color on hover | | `--pagination-item-foreground` | `var(--foreground)` | Text color for pagination items | | `--pagination-item-foreground-hover` | `var(--accent-foreground)` | Text color on hover | | `--pagination-item-active-background` | `var(--primary)` | Background color for active/current page | | `--pagination-item-active-foreground` | `var(--primary-foreground)` | Text color for active/current page | ### Theming Examples #### Global Customization Customize all pagination by setting CSS variables in your theme: ```css /* app/view/assets/app.css */ @theme { /* Make pagination items larger */ --pagination-item-size: 3rem; --pagination-item-font-size: 1rem; --pagination-gap: 0.5rem; /* Make items more rounded */ --pagination-item-border-radius: 0.5rem; /* Customize hover colors */ --pagination-item-background-hover: hsl(210 40% 96%); --pagination-item-foreground-hover: hsl(222.2 47.4% 11.2%); } ``` #### Local Overrides Override CSS variables for specific pagination instances: ```tsx
{/* Compact pagination */}
{/* Circular pagination items */}
``` #### Component-Specific Theming Create themed sections with different pagination styles: ```tsx
{/* Pagination with primary theme */}
{/* Compact pagination for mobile */}
``` ## Examples ### Basic Example ```tsx ``` ### With Custom Styling ```tsx ``` ### With Unpoly Integration ```tsx ```