Choose target="window" to observe page scrolling, or target="parent" for the immediate parent element. Give that parent a bounded height and overflow:auto. threshold is a vertical scroll distance in pixels; the button appears above it. behavior chooses auto or smooth scrolling. The default chevron is built in and needs no icon provider.
ScrollTop observes browser scroll state and scrolls its target when activated. It has no Outputs. icon resolves an optional application-provided icon key; neuScrollTopIcon replaces the visual icon with projected content while preserving the native button label.
Translate buttonAriaLabel to describe the destination. Tab reaches the visible button; Enter or Space activates it. Decorative Template icons should be aria-hidden. The component checks browser availability and does not access a missing window during server rendering.
Observe the window or the immediate parent scroller.
threshold
number
400
[threshold]
Vertical scroll distance in pixels above which the button appears.
Templates
ng-content projects content into the component. TemplateRef inputs receive a template; ng-template directives identify templates with a typed context. A directive shared by an entrypoint is not necessarily a slot of this component.
import { NeuScrollTopIconDirective } from '@neural-ui/core/scroll-top';
// Public declaration (reference only)
export declare class NeuScrollTopIconDirective {
}
context.d.ts
import { NeuScrollTopIconDirective } from '@neural-ui/core/scroll-top';
// Public declaration (reference only)
readonly templateRef: TemplateRef<void>;
Each example demonstrates a different template. Switch between Demo and Code to inspect its implementation, imports and state.
Custom return icon
NeuScrollTopIconDirective
Custom return icon
Scroll the panel down to reveal the return button. The window option observes the page instead.
Chapter 1
Read this section, then continue to the next chapter.
Chapter 2
Read this section, then continue to the next chapter.
Chapter 3
Read this section, then continue to the next chapter.
Chapter 4
Read this section, then continue to the next chapter.
Chapter 5
Read this section, then continue to the next chapter.
Chapter 6
Read this section, then continue to the next chapter.
Chapter 7
Read this section, then continue to the next chapter.
Chapter 8
Read this section, then continue to the next chapter.
Chapter 9
Read this section, then continue to the next chapter.
Chapter 10
Read this section, then continue to the next chapter.
Chapter 11
Read this section, then continue to the next chapter.
Chapter 12
Read this section, then continue to the next chapter.
Public Types
Open a type to inspect its definition and interface fields.
NeuScrollTopBehavior.d.ts
import type { NeuScrollTopBehavior } from '@neural-ui/core/scroll-top';
// Public declaration (reference only)
export type NeuScrollTopBehavior = 'auto' | 'smooth';
NeuScrollTopTarget.d.ts
import type { NeuScrollTopTarget } from '@neural-ui/core/scroll-top';
// Public declaration (reference only)
export type NeuScrollTopTarget = 'window' | 'parent';