Files
WRNexusJSDoc/app/pages/components/pagination.wrn
T
2026-07-22 01:56:18 +05:30

207 lines
14 KiB
Plaintext

page Paginationcomponent {
seo {
title = "Pagination component"
description = "Reusable pagination component."
}
view {
<div class="docs-shell">
<SkipLink label="Skip to content" href="#main" class="docs-skip-link" />
<header class="topbar">
<a class="brand" href="/"><span>W</span> WRNexusJS</a>
<nav aria-label="Primary"><a href="/getting-started">Get started</a><a href="/packages">Packages</a><a href="/components">Components</a><a href="/language">Language</a><a href="/architecture">Architecture</a></nav>
<div class="topbar-actions"><a class="preview-pill" href="/access">Private preview · v0.2.77</a><button data-wire-theme-toggle class="theme-button" aria-label="Toggle color theme" title="Toggle color theme">◐</button></div>
</header>
<div class="mobile-doc-nav"><details><summary>Browse documentation</summary><nav><a href="/getting-started">Get started</a><a href="/packages">Packages</a><a href="/components">Components</a><a href="/language">Language</a><a href="/architecture">Architecture</a><a href="/tutorial">Tutorial</a><a href="/guides/project-structure">Guides</a><a href="/examples">Examples</a><a href="/search">Search</a></nav></details></div>
<main class="portal-main docs-layout component-detail-page"><article id="main" class="documentation prose standalone"><nav class="breadcrumbs" aria-label="Breadcrumb"><a href="/">Home</a><span>/</span><a href="/components">Components</a><span>/</span><span aria-current="page">Pagination</span></nav><section class="doc-intro"><span class="eyebrow">core component</span><h1>Pagination</h1><p>Reusable pagination component.</p><div class="doc-meta"><span>@wrnexus/ui 0.2.77</span><span>12 props</span><span>0 slots</span><span>0 events</span></div></section><section id="usage"><h2>Usage</h2><p>Components are auto-discovered. Use the component directly in any <code>.wrn</code> view:</p><pre data-language="wrn"><code>&lt;Pagination
currentPage=&quot;1&quot;
totalPages=&quot;1&quot;
previousHref=&quot;previousHref&quot;
nextHref=&quot;nextHref&quot;
pages=&quot;[]&quot;
/&gt;</code></pre><p>Legacy mount name: <code>data-component=&quot;Pagination&quot;</code>.</p></section><section id="props"><h2>Props and attributes</h2><div class="table-wrap"><table><thead><tr><th>Prop</th><th>Type</th><th>Requirement</th><th>Default</th></tr></thead><tbody><tr><td><code>class</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr><tr><td><code>currentPage</code></td><td><code>number</code></td><td>Optional</td><td><code>1</code></td></tr><tr><td><code>totalPages</code></td><td><code>number</code></td><td>Optional</td><td><code>1</code></td></tr><tr><td><code>previousHref</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr><tr><td><code>nextHref</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr><tr><td><code>pages</code></td><td><code>string</code></td><td>Optional</td><td><code>[]</code></td></tr><tr><td><code>showNumbers</code></td><td><code>boolean</code></td><td>Optional</td><td><code>true</code></td></tr><tr><td><code>showSummary</code></td><td><code>boolean</code></td><td>Optional</td><td><code>true</code></td></tr><tr><td><code>totalItems</code></td><td><code>number</code></td><td>Optional</td><td><code>0</code></td></tr><tr><td><code>pageSize</code></td><td><code>number</code></td><td>Optional</td><td><code>10</code></td></tr><tr><td><code>compact</code></td><td><code>boolean</code></td><td>Optional</td><td><code>false</code></td></tr><tr><td><code>centered</code></td><td><code>boolean</code></td><td>Optional</td><td><code>false</code></td></tr></tbody></table></div></section><section id="slots"><h2>Slots</h2><p>This component does not declare a slot.</p></section><section id="events"><h2>Events</h2><p>This component does not declare a custom event.</p></section><section id="source"><h2>Source contract</h2><p>Installed source: <code>components/Pagination.wrn</code></p><pre data-language="wrn"><code>component Pagination &#123;
props &#123;
class: string = &quot;&quot;
currentPage = 1
totalPages = 1
previousHref = &quot;&quot;
nextHref = &quot;&quot;
pages = []
showNumbers = true
showSummary = true
totalItems = 0
pageSize = 10
compact = false
centered = false
&#125;
view &#123;
&lt;nav
aria-label=&quot;Pagination&quot;
class=&quot;w-full &#123;class&#125;&quot;
class:hidden=&quot;totalPages &lt;= 1&quot;
&gt;
&lt;!-- Result summary --&gt;
&lt;div
class=&quot;mb-4 text-sm text-slate-500 dark:text-slate-400&quot;
class:hidden=&quot;!showSummary || totalItems &lt;= 0&quot;
class:text-center=&quot;centered&quot;
&gt;
Showing
&lt;span class=&quot;font-semibold text-slate-950 dark:text-white&quot;&gt;
&#123;(currentPage - 1) * pageSize + 1&#125;
&lt;/span&gt;
to
&lt;span class=&quot;font-semibold text-slate-950 dark:text-white&quot;&gt;
&#123;currentPage * pageSize &gt; totalItems ? totalItems : currentPage * pageSize&#125;
&lt;/span&gt;
of
&lt;span class=&quot;font-semibold text-slate-950 dark:text-white&quot;&gt;
&#123;totalItems&#125;
&lt;/span&gt;
results
&lt;/div&gt;
&lt;div
class=&quot;flex flex-col gap-4 sm:flex-row sm:items-center&quot;
class:sm:justify-center=&quot;centered&quot;
class:sm:justify-between=&quot;!centered&quot;
&gt;
&lt;!-- Previous --&gt;
&lt;a
href=&quot;&#123;previousHref&#125;&quot;
aria-label=&quot;Go to previous page&quot;
class=&quot;group h-11 items-center justify-center gap-2 rounded-xl border border-slate-200 bg-white px-4 text-sm font-semibold text-slate-700 shadow-sm transition hover:-translate-y-0.5 hover:border-indigo-300 hover:bg-slate-50 hover:text-indigo-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 dark:border-white/10 dark:bg-white/5 dark:text-slate-200 dark:hover:border-indigo-500/30 dark:hover:bg-white/10 dark:hover:text-indigo-300&quot;
class:hidden=&quot;previousHref === ''&quot;
class:inline-flex=&quot;previousHref !== ''&quot;
&gt;
&lt;span class=&quot;icon-[lucide--arrow-left] h-4 w-4 transition-transform group-hover:-translate-x-0.5&quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&lt;span class:hidden=&quot;compact&quot;&gt;
Previous
&lt;/span&gt;
&lt;/a&gt;
&lt;span
aria-disabled=&quot;true&quot;
class=&quot;h-11 cursor-not-allowed items-center justify-center gap-2 rounded-xl border border-slate-200 bg-slate-50 px-4 text-sm font-semibold text-slate-400 dark:border-white/10 dark:bg-white/[0.03] dark:text-slate-600&quot;
class:hidden=&quot;previousHref !== ''&quot;
class:inline-flex=&quot;previousHref === ''&quot;
&gt;
&lt;span class=&quot;icon-[lucide--arrow-left] h-4 w-4&quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&lt;span class:hidden=&quot;compact&quot;&gt;
Previous
&lt;/span&gt;
&lt;/span&gt;
&lt;!-- Numbered pages --&gt;
&lt;div
class=&quot;flex flex-wrap items-center justify-center gap-1.5&quot;
class:hidden=&quot;!showNumbers&quot;
&gt;
&#123;#each pages as page&#125;
&lt;!-- Ellipsis --&gt;
&lt;span
class=&quot;grid h-10 w-10 place-items-center text-sm font-semibold text-slate-400&quot;
class:hidden=&quot;!page.ellipsis&quot;
&gt;
&lt;/span&gt;
&lt;!-- Page link --&gt;
&lt;a
href=&quot;&#123;page.href&#125;&quot;
aria-label=&quot;Go to page &#123;page.number&#125;&quot;
class=&quot;h-10 min-w-10 items-center justify-center rounded-xl px-3 text-sm font-semibold transition focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500&quot;
class:hidden=&quot;page.ellipsis || page.current&quot;
class:inline-flex=&quot;!page.ellipsis &amp;&amp; !page.current&quot;
class:border=&quot;!page.current&quot;
class:border-slate-200=&quot;!page.current&quot;
class:bg-white=&quot;!page.current&quot;
class:text-slate-600=&quot;!page.current&quot;
class:hover:border-indigo-300=&quot;!page.current&quot;
class:hover:bg-indigo-50=&quot;!page.current&quot;
class:hover:text-indigo-700=&quot;!page.current&quot;
class:dark:border-white/10=&quot;!page.current&quot;
class:dark:bg-white/5=&quot;!page.current&quot;
class:dark:text-slate-300=&quot;!page.current&quot;
class:dark:hover:border-indigo-500/30=&quot;!page.current&quot;
class:dark:hover:bg-indigo-500/10=&quot;!page.current&quot;
class:dark:hover:text-indigo-300=&quot;!page.current&quot;
&gt;
&#123;page.number&#125;
&lt;/a&gt;
&lt;!-- Current page --&gt;
&lt;span
aria-current=&quot;page&quot;
aria-label=&quot;Current page, page &#123;page.number&#125;&quot;
class=&quot;h-10 min-w-10 items-center justify-center rounded-xl bg-indigo-600 px-3 text-sm font-bold text-white shadow-lg shadow-indigo-600/20&quot;
class:hidden=&quot;page.ellipsis || !page.current&quot;
class:inline-flex=&quot;!page.ellipsis &amp;&amp; page.current&quot;
&gt;
&#123;page.number&#125;
&lt;/span&gt;
&#123;/each&#125;
&lt;/div&gt;
&lt;!-- Mobile page counter --&gt;
&lt;div
class=&quot;flex items-center justify-center rounded-xl border border-slate-200 bg-slate-50 px-4 py-2.5 text-sm font-medium text-slate-500 dark:border-white/10 dark:bg-white/5 dark:text-slate-400&quot;
class:hidden=&quot;showNumbers&quot;
&gt;
Page
&lt;span class=&quot;mx-1 font-bold text-slate-950 dark:text-white&quot;&gt;
&#123;currentPage&#125;
&lt;/span&gt;
of
&lt;span class=&quot;ml-1 font-bold text-slate-950 dark:text-white&quot;&gt;
&#123;totalPages&#125;
&lt;/span&gt;
&lt;/div&gt;
&lt;!-- Next --&gt;
&lt;a
href=&quot;&#123;nextHref&#125;&quot;
aria-label=&quot;Go to next page&quot;
class=&quot;group h-11 items-center justify-center gap-2 rounded-xl bg-indigo-600 px-4 text-sm font-bold text-white shadow-lg shadow-indigo-600/20 transition hover:-translate-y-0.5 hover:bg-indigo-500 hover:shadow-xl focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-slate-950&quot;
class:hidden=&quot;nextHref === ''&quot;
class:inline-flex=&quot;nextHref !== ''&quot;
&gt;
&lt;span class:hidden=&quot;compact&quot;&gt;
Next
&lt;/span&gt;
&lt;span class=&quot;icon-[lucide--arrow-right] h-4 w-4 transition-transform group-hover:translate-x-0.5&quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&lt;/a&gt;
&lt;span
aria-disabled=&quot;true&quot;
class=&quot;h-11 cursor-not-allowed items-center justify-center gap-2 rounded-xl border border-slate-200 bg-slate-50 px-4 text-sm font-semibold text-slate-400 dark:border-white/10 dark:bg-white/[0.03] dark:text-slate-600&quot;
class:hidden=&quot;nextHref !== ''&quot;
class:inline-flex=&quot;nextHref === ''&quot;
&gt;
&lt;span class:hidden=&quot;compact&quot;&gt;
Next
&lt;/span&gt;
&lt;span class=&quot;icon-[lucide--arrow-right] h-4 w-4&quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;/nav&gt;
&#125;
&#125;
</code></pre></section></article><aside class="on-this-page"><h2>On this page</h2><nav><a href="#usage">Usage</a><a href="#props">Props and attributes</a><a href="#slots">Slots</a><a href="#events">Events</a><a href="#source">Source contract</a></nav></aside></main>
<footer><div class="footer-brand"><span class="footer-mark" aria-hidden="true">W</span><p><strong>WRNexusJS 0.2.77</strong><span>Complete API documentation generated from installed package declarations.</span></p></div><nav aria-label="Footer"><a href="/packages">All packages</a><a href="/getting-started">Get started</a><a href="/security">Security</a><a href="/support">Support</a><a href="/llms.txt">AI guide</a></nav><p class="footer-meta">Private Developer Preview · Bun-native</p></footer>
<BackToTop />
</div>
}
}