page BackToTopcomponent {
  seo {
    title = "BackToTop component"
    description = "Reusable back to top 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.3.2</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">BackToTop</span></nav><section class="doc-intro"><span class="eyebrow">core component</span><h1>BackToTop</h1><p>Reusable back to top component.</p><div class="doc-meta"><span>@wrnexus/ui 0.3.2</span><span>4 props</span><span>0 slots</span><span>1 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;BackToTop
  label=&quot;Back to top&quot;
  assistiveLabel=&quot;Return to the top of the page&quot;
  threshold=&quot;500&quot;
/&gt;</code></pre><p>Legacy mount name: <code>data-component=&quot;BackToTop&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>label</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;Back to top&quot;</code></td></tr><tr><td><code>assistiveLabel</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;Return to the top of the page&quot;</code></td></tr><tr><td><code>threshold</code></td><td><code>number</code></td><td>Optional</td><td><code>500</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><ul><li><code>click</code></li></ul></section><section id="source"><h2>Source contract</h2><p>Installed source: <code>components/BackToTop.wrn</code></p><pre data-language="wrn"><code>component BackToTop &#123;
    props &#123;
        class = &quot;&quot;
        label = &quot;Back to top&quot;
        assistiveLabel = &quot;Return to the top of the page&quot;
        threshold = 500
    &#125;

    state visible = false

    functions &#123;
        function updateBackToTopVisibility() &#123;
            visible = window.scrollY &gt; threshold
        &#125;

        function scrollToTop() &#123;
            window.scrollTo(&#123;
                top: 0,
                behavior: &quot;smooth&quot;
            &#125;)
        &#125;
    &#125;

    lifecycle &#123;
        mount &#123;
            updateBackToTopVisibility()

            window.addEventListener(
            &quot;scroll&quot;,
            updateBackToTopVisibility,
            &#123; passive: true &#125;
            )
        &#125;

        unmount &#123;
            window.removeEventListener(
            &quot;scroll&quot;,
            updateBackToTopVisibility
            )
        &#125;
    &#125;

    watch visible &#123;
        console.debug(
        &quot;Back-to-top visibility:&quot;,
        value,
        previous
        )
    &#125;

    view &#123;
        &lt;div
            class=&quot;group fixed bottom-6 right-5 z-[70] flex items-center gap-2 transition-all duration-300 sm:right-6 lg:bottom-8 lg:right-8 &#123;class&#125;&quot;
            class:pointer-events-none=&quot;!visible&quot;
            class:translate-y-5=&quot;!visible&quot;
            class:scale-90=&quot;!visible&quot;
            class:opacity-0=&quot;!visible&quot;
            class:pointer-events-auto=&quot;visible&quot;
            class:translate-y-0=&quot;visible&quot;
            class:scale-100=&quot;visible&quot;
            class:opacity-100=&quot;visible&quot;
        &gt;
        &lt;!-- Hover label --&gt;
        &lt;span
                class=&quot;pointer-events-none hidden translate-x-2 whitespace-nowrap rounded-xl border border-slate-200 bg-white/95 px-3 py-2 text-xs font-semibold text-slate-700 opacity-0 shadow-lg shadow-slate-950/10 backdrop-blur-xl transition-all duration-200 group-hover:translate-x-0 group-hover:opacity-100 dark:border-white/10 dark:bg-slate-900/95 dark:text-slate-200 dark:shadow-black/30 sm:block&quot;
            &gt;
                &#123;label&#125;
            &lt;/span&gt;
        &lt;!-- Gradient border wrapper --&gt;
        &lt;div
                class=&quot;relative rounded-2xl bg-linear-to-br from-indigo-500 via-violet-500 to-cyan-500 p-px shadow-xl shadow-indigo-600/20 transition duration-300 group-hover:-translate-y-1 group-hover:shadow-2xl group-hover:shadow-indigo-600/30&quot;
            &gt;
        &lt;!-- Glow --&gt;
        &lt;div aria-hidden=&quot;true&quot; class=&quot;absolute inset-1 rounded-2xl bg-indigo-500/20 opacity-0 blur-xl transition-opacity duration-300 group-hover:opacity-100&quot; &gt;
        &lt;/div&gt;
        &lt;button
                    type=&quot;button&quot;
                    @click=&quot;scrollToTop()&quot;
                    aria-label=&quot;&#123;label&#125;&quot;
                    title=&quot;&#123;label&#125;&quot;
                    class=&quot;relative grid h-12 w-12 place-items-center rounded-[15px] bg-white/95 text-indigo-700 backdrop-blur-xl transition duration-300 hover:bg-indigo-600 hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2 active:scale-95 dark:bg-slate-900/95 dark:text-indigo-300 dark:hover:bg-indigo-500 dark:hover:text-white dark:focus-visible:ring-offset-slate-950 sm:h-13 sm:w-13&quot;
                &gt;
        &lt;!-- Arrow --&gt;
        &lt;span class=&quot;icon-[lucide--arrow-up] h-5 w-5 transition-transform duration-300 group-hover:-translate-y-0.5&quot; aria-hidden=&quot;true&quot; &gt;
        &lt;/span&gt;
        &lt;span class=&quot;sr-only&quot;&gt;
                        &#123;assistiveLabel&#125;
                    &lt;/span&gt;
        &lt;/button&gt;
        &lt;/div&gt;
        &lt;/div&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.3.2</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>
  }
}
