GoToTop
A link that returns users to the top of a long page. Typically rendered as a fixed or sticky element near the bottom-right of the viewport on long-scrolling pages.
A link that returns users to the top of a long page. Typically rendered as a fixed or sticky element near the bottom-right of the viewport on long-scrolling pages.
<div class="go-to-top" aria-label="a link that returns users to the top of a long page">GoToTop</div><div class="go-to-top" aria-label="a link that returns users to the top of a long page">GoToTop</div>
// In your Svelte component:
import GoToTop from "lily-design-system-svelte-headless/components/GoToTop/GoToTop.svelte";
<GoToTop>
<!-- content -->
</GoToTop>
<GoToTop label="Back to top" href="#top" />
| Prop | Type | Default | Description |
|---|---|---|---|
href | string | #top | Anchor target on the current page |
label | string | — | Visible link text. Required. |
...restProps | HTML attributes | — | Spread onto the root <a> element |
aria-label when the visible text is decorativeBackLink to navigate back to a parent or previous page (different intent)GoToPreviousSection / GoToNextSection for adjacent-section navigationThis headless component renders semantic HTML (<a href="#…">) with no styling. Consumers position and style the link (often as a fixed/sticky button-like control), and may layer smooth-scroll behaviour with JavaScript.
The component renders with .go-to-top as the root class. No default styles are included — consumers handle positioning, appearance, and any animation.
back-link — navigate to a parent or previous pagego-to-previous-section / go-to-next-section — adjacent-section navigation within a pageskip-link — keyboard-only "skip to main content" link<a> linking to an in-page anchor (default #top)prefers-reduced-motion automaticallyaria-label for icon-only variantsGenerated from this component's canonical metadata — the machine-checked source the implementations are held to.
aria-label when the visible text is decorative (e.g. just an arrow icon)href: string (default: "#top") -- anchor target on the current pagelabel: string (required) -- visible link text...restProps: HTML attributes spread onto the root <a>