Skip to content

Feature Back To Top

teociaps edited this page Nov 27, 2025 · 2 revisions

Back to Top Button

Add a floating button that scrolls smoothly to the top of the page.

Why Use It?

  • Improved Navigation - One-click return to top
  • Long Documents - Essential for APIs with many endpoints
  • Smart Display - Only appears after scrolling down
  • Smooth Scroll - Animated scroll for better UX

Visual Example

back-to-top gif

Quick Start

Swashbuckle

using AspNetCore.Swagger.Themes;

app.UseSwaggerUI(Theme.Dark, options =>
{
    options.ShowBackToTopButton();
});

NSwag

using AspNetCore.Swagger.Themes;

app.UseSwaggerUi(Theme.Dark, settings =>
{
    settings.ShowBackToTopButton();
});

Customization

Customize button appearance:

:root {
  --scroll-to-top-button-background-color: #your-color;
  --scroll-to-top-button-hover-background-color: #your-hover-color;
  --scroll-to-top-button-border-color: #your-border-color;
  --scroll-to-top-button-icon-color: #your-icon-color;
}

Compatibility

Works with:

Next Steps


Back to Advanced Options

Clone this wiki locally