Skip to main content
Neural UIv2.0.0Documentation
View v1 GitHub

ScrollArea

Keep long content in a bounded, keyboard-accessible scroll viewport.

Category
Layout and content
Import
@neural-ui/core/panel
Selector
neu-scroll-area
import { NeuScrollAreaComponent } from '@neural-ui/core/panel';

Usage

Native scrolling is the default. Set maxHeight and optionally maxWidth using CSS dimensions. enhanced adds themed scrollbars while retaining wheel, touch and native scrolling. variant controls track visibility; mask adds edge fades. ariaLabel names the viewport, tabindex controls focus and step controls enhanced scrollbar movement. scrollTo() can return to the start; scrollPositionChange reports observed dimensions and offsets.

Examples

Try the behavior and open Code for the implementation.

Examples
  1. Order 1 โ€” Ready for dispatch
  2. Order 2 โ€” Ready for dispatch
  3. Order 3 โ€” Ready for dispatch
  4. Order 4 โ€” Ready for dispatch
  5. Order 5 โ€” Ready for dispatch
  6. Order 6 โ€” Ready for dispatch
  7. Order 7 โ€” Ready for dispatch
  8. Order 8 โ€” Ready for dispatch
  9. Order 9 โ€” Ready for dispatch
  10. Order 10 โ€” Ready for dispatch
  11. Order 11 โ€” Ready for dispatch
  12. Order 12 โ€” Ready for dispatch

Vertical position: 0

Try and configure

Change the options and try the result. The generated template follows your configuration; Code contains the complete executable source.

Try and configure
  1. Order 1 โ€” Ready for dispatch
  2. Order 2 โ€” Ready for dispatch
  3. Order 3 โ€” Ready for dispatch
  4. Order 4 โ€” Ready for dispatch
  5. Order 5 โ€” Ready for dispatch
  6. Order 6 โ€” Ready for dispatch
  7. Order 7 โ€” Ready for dispatch
  8. Order 8 โ€” Ready for dispatch
  9. Order 9 โ€” Ready for dispatch
  10. Order 10 โ€” Ready for dispatch
  11. Order 11 โ€” Ready for dispatch
  12. Order 12 โ€” Ready for dispatch

Vertical position: 0

template.html
<neu-scroll-area
  maxHeight="200px"
  [enhanced]="false"
  [mask]="true"
  variant="auto"
  [step]="40"
  [tabindex]="0"
  ariaLabel="Recent orders"
  (scrollPositionChange)="position.set($event)"
>
  <ol>
    @for (n of entries; track n) {
      <li>Order {{ n }}</li>
    }
  </ol>
</neu-scroll-area>

Data and content

Content belongs to default projection. scrollPositionChange reports scroll observations, not a controlled value proposal. Its left offset is logical and normalized for RTL. Call scrollTo() to scroll the viewport from your application.

Accessibility and keyboard

Give scrollable content an ariaLabel so the focusable viewport is a named region. Arrow/Page keys retain native viewport scrolling. Enhanced tracks expose scrollbar roles, controlled viewport IDs and current/minimum/maximum values. Keep tabindex at 0 when keyboard users need access.

Key
Action
Tab Focus the named scroll viewport and its interactive content.
Arrow keys Scroll the focused viewport using native browser behaviour.
PageUp / PageDown Scroll the focused viewport a page at a time.

API

Inputs and Outputs match the pinned package. Named types link to their definitions; each supported Template has an executable example.

Inputs

Configure the component with [property]="value". Your application supplies these values; the component does not replace the state you pass in.

Name
Type
Default
Template binding
Description
ariaLabelstring''[ariaLabel]Accessible name of the scroll viewport.
enhancedbooleanfalse[enhanced]Enable themed scrollbar tracks; native scrolling remains.
maskbooleantrue[mask]Fade viewport edges where more content is available.
maxHeightstring'240px'[maxHeight]Maximum viewport height as a CSS dimension.
maxWidthstring | nullnull[maxWidth]Optional maximum viewport width as a CSS dimension.
stepnumber40[step]Movement in pixels for enhanced track controls.
tabindexnumber0[tabindex]Viewport tab index, usually 0 or -1.
variantNeuScrollAreaVariant'auto'[variant]Visibility policy of enhanced tracks.

Outputs

Listen to an event with (event)="handler($event)". The table explains the data your handler receives and how to use it.

Name
Payload
Template binding
Description
scrollPositionChangeNeuScrollPosition(scrollPositionChange)="onScrollPositionChange($event)"Reports observed top/left and scroll/client dimensions.

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.

Name
Mechanism
Contract
*

Scrollable viewport content

View example
Content projection

Project text, lists or controls inside the bounded native viewport.

<ng-content />

Context used: โ€”

Each example demonstrates a different template. Switch between Demo and Code to inspect its implementation, imports and state.

Scrollable content

*

Scrollable content

Delivery 1

Leave the parcel at reception during office hours.

Delivery 2

Leave the parcel at reception during office hours.

Delivery 3

Leave the parcel at reception during office hours.

Delivery 4

Leave the parcel at reception during office hours.

Delivery 5

Leave the parcel at reception during office hours.

Delivery 6

Leave the parcel at reception during office hours.

Delivery 7

Leave the parcel at reception during office hours.

Delivery 8

Leave the parcel at reception during office hours.

Delivery 9

Leave the parcel at reception during office hours.

Delivery 10

Leave the parcel at reception during office hours.

Delivery 11

Leave the parcel at reception during office hours.

Delivery 12

Leave the parcel at reception during office hours.

Public methods

Name
Contract
scrollToscrollTo(options: ScrollToOptions): void;

Public Types

Open a type to inspect its definition and interface fields.

Styles and tokens

Use public tokens for spacing, surface, text and focus. Check projected content and controls in both themes and at narrow widths.

Specific tokens

This component uses shared theme tokens rather than dedicated component hooks.

Shared tokens used

Override these on a local wrapper to affect this example. An override on :root affects other components that use the same token.

Token
Purpose here
Other impact
Default / fallback
No data