n-back-top

Create a scroll-to-top button with scrollable ancestor detection and configurable position.

8|3|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/jiaiyan/naive-ui-skills --skill n-back-top
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n-back-top
Source: https://github.com/jiaiyan/naive-ui-skills/tree/main/components/n-back-top
Command: npx skills add https://github.com/jiaiyan/naive-ui-skills --skill n-back-top

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

BackTop components solve long-page navigation by providing an always-available scroll-to-top button.

Core Features & Use Cases

  • Auto-detection of first scrollable ancestor
  • Visibility control based on scroll threshold
  • Configurable position on the page (right/bottom)
  • Custom content via slots, and target container support
  • Useful for documentation sites, dashboards, and long-form content

Quick Start

Create an n-back-top component instance in your template and tune its props to match your layout and UX requirements.

Frequently Asked Questions about n-back-top

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a scroll to top button in Vue for long page navigation?

A scroll to top button provides an always-available control for long page navigation. You can add it to Vue projects by creating a back-top component instance in your template and tuning its props to match your layout and UX requirements.

What is auto-detection of scrollable ancestor in a back to top component?

Auto-detection of scrollable ancestor allows a back to top component to automatically identify the first scrollable parent container. This means the scroll-to-top button works without manually specifying which container the user is scrolling within.

Can I control the visibility and position of a scroll to top button?

Yes, you can control visibility based on a scroll threshold and configure the position on the page, such as adjusting the right and bottom offsets. This ensures the scroll to top button appears only when needed and fits your layout.

Does the back to top component work with naive-ui and support custom content?

The back to top component supports custom content via slots, allowing you to replace the default button UI. It is designed for web development scenarios like documentation sites, dashboards, and product catalogs built with naive-ui.

How do I target a specific container when implementing a scroll to top button?

You can target a specific container for your scroll to top button using the target container support feature. This lets you bind the scroll action to a particular scrollable area rather than relying solely on auto-detection of the first scrollable ancestor.