ScrollToTop
Button that scrolls to top of page or container
Scroll the contents of this frame to reveal the ScrollToTop button.
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8
Item 9
Item 10
Accessibility
- Provide discernible text or an aria-label for controls that do not expose visible text.
- Use button semantics for in-place actions and link semantics for navigation.
- Only add region semantics when the scrollable surface has a unique, meaningful label.
Styled quick start
Copy this entrypoint first. It includes the imports required to get the component on screen.
svelte
<script lang="ts">
import '@dryui/ui/themes/default.css';
import '@dryui/ui/themes/dark.css';
import { ScrollToTop } from '@dryui/ui';
</script>
<ScrollToTop>Content</ScrollToTop> Import options
Root package
ts
import { ScrollToTop } from '@dryui/ui' Per-component subpath
ts
import { ScrollToTop } from '@dryui/ui/scroll-to-top' API
Props, CSS variables, and the public data attributes you can target when styling.
| Prop | Type | Description | Default | Required | Bindable |
|---|---|---|---|---|---|
| position | bottom-rightbottom-leftbottom-center | — | 'bottom-right' | — | — |
| class | string | — | — | — | — |
| threshold | number | — | 300 | — | — |
| target | HTMLElement | Browsing context used for link navigation. | — | — | — |
| behavior | ScrollBehavior | — | 'smooth' | — | — |
| children | Snippet<[{ visible: boolean; scrollToTop: () => void }]> | Content rendered inside the component. | — | ✓ | — |