Back To Top
The default button appears after Scroll down to reveal the floating button. The interactive behavior is powered by Alpine data component RzBackToTop renders a floating action that appears after crossing a scroll threshold and uses Alpine to smoothly return the viewport to the top.Threshold pixels of scroll.<div class="relative min-h-[150vh] p-8">
<RzBackToTop />
</div>Property Description Type Default ChildContentOptional content. If omitted, the component renders an arrow icon. RenderFragment?nullThresholdScroll offset in pixels before showing the control. int300VariantApplies theme color styling. ThemeVariantThemeVariant.DefaultSizeControls button and icon sizing. SizeSize.MediumOutlineApplies outline styling as a compound variant. boolfalseAriaLabelAccessible label for assistive technology. string?"Back to top"AsChildMerges behavior and classes onto a supplied child element. boolfalserzBackToTop.Member Type Description visibleboolControls whether the floating action is displayed. thresholdnumberResolved from data-threshold.Method Signature Description init()Reads threshold, binds a passive scroll listener, and performs an immediate visibility evaluation. scrollToTop()Scrolls to the top using smooth behavior unless reduced motion is preferred.destroy()Removes the window scroll listener.