// Generated by scripts/generate-showcase.mjs. Do not edit directly. page BackToTopDetail { layout = "showcase" state playground_threshold = Number(ctx.url.searchParams.get("pg_threshold") ?? "500") state playground_label = ctx.url.searchParams.get("pg_label") ?? "Back To Top" state playground_ariaLabel = ctx.url.searchParams.get("pg_ariaLabel") ?? "Back To Top 1 example" state playground_icon = ctx.url.searchParams.get("pg_icon") ?? "" state playground_position = ctx.url.searchParams.get("pg_position") ?? "right" state playground_offset = ctx.url.searchParams.get("pg_offset") ?? "md" state playground_behavior = ctx.url.searchParams.get("pg_behavior") ?? "smooth" state playground_showProgress = (ctx.url.searchParams.get("pg_showProgress") ?? "true") === "true" state playground_showLabel = (ctx.url.searchParams.get("pg_showLabel") ?? "true") === "true" state playground_alwaysVisible = (ctx.url.searchParams.get("pg_alwaysVisible") ?? "true") === "true" state playground_size = ctx.url.searchParams.get("pg_size") ?? "default" state playground_color = ctx.url.searchParams.get("pg_color") ?? "primary" state playground_variant = ctx.url.searchParams.get("pg_variant") ?? "solid" state playground_shape = ctx.url.searchParams.get("pg_shape") ?? "round" state playground_class = ctx.url.searchParams.get("pg_class") ?? "showcase-instance showcase-instance--1" seo { title = "Back To Top" description = "Provide a responsive floating control that returns long pages to the top and can show scroll progress." } view {
Navigation component

Back To Top

Provide a responsive floating control that returns long pages to the top and can show scroll progress.

15 props0 slots0 outputsTheme readyResponsive
Interactive playground

Configure Back To Top

Change any prop and inspect the server-rendered component immediately.

Live preview
Component code
<BackToTop
  label="Back To Top"
  ariaLabel="Back To Top 1 example"
  showProgress="true"
  showLabel="true"
/>
Component props15 controls
Live examples

Designed for real product surfaces

Compare configurations and resize the browser to check responsive behavior.

Recommended

Floating round control

Return visitors to the top of a long page after the scroll threshold is reached.

01
Live preview
Component usage.wrn
<BackToTop
  label="Back To Top"
  ariaLabel="Back To Top 1 example"
  showProgress="true"
  showLabel="true"
  alwaysVisible="true"
/>
Compact

Pill control with label

Show a visible text label when the action needs extra clarity.

02
Live preview
Component usage.wrn
<BackToTop
  ariaLabel="Back To Top 2 example"
  icon="icon-[lucide--arrow-right]"
  showProgress="true"
  showLabel="true"
  alwaysVisible="true"
  size="sm"
  variant="soft"
  shape="pill"
/>
Advanced

Progress-aware control

Display page scroll progress around the floating control on long articles or directories.

03
Live preview
Component usage.wrn
<BackToTop
  label="Advanced example"
  ariaLabel="Back To Top 3 example"
  icon="icon-[lucide--trash-2]"
  position="left"
  offset="lg"
  showProgress="true"
  showLabel="true"
  alwaysVisible="true"
  size="lg"
  variant="outline"
/>
Component API

Props and configuration

All content and behavior shown above is supplied through these props and slots.

PropTypeDefaultRequired
thresholdnumber500No
labelstring"Back to top"No
ariaLabelstring"Scroll back to top"No
iconstring"icon-[lucide--arrow-up]"No
positionstring"right"No
offsetstring"md"No
behaviorstring"smooth"No
showProgressbooleanfalseNo
showLabelbooleanfalseNo
alwaysVisiblebooleanfalseNo
sizestring"default"No
colorstring"primary"No
variantstring"solid"No
shapestring"round"No
classstring""No
} }