Scroll area

stable 1.6 kB
<hk-scroll-area>

Styled scrollbars with edge fades that track the real scroll position, so the fade only appears when there is genuinely more content that way.

#overflow
In the package npm i hellskitchen-ui Import hk-scroll-area and use it directly.

Live demo

Running in this page — interact with it.

Inputs

NameTypeDefaultDescription
maxHeightstring'20rem'Height before the area scrolls.
fadebooleantrueShows gradient affordances at the top and bottom edges while there is more content that way.
axis'y' | 'x' | 'both''y'Which direction scrolls.

Outputs

  • scrolledEventEmitter<{ top: boolean; bottom: boolean }>

    Emits when the top or bottom edge is reached or left.

Keyboard

  • ↑ / ↓ Scrolls when the area has focus
  • Page Up / Page Down Scrolls by a viewport

Theming

Component tokens, each falling back to a global one:

PropertyDefaultControls
--hk-scroll-thumb#e2e8f0Scrollbar thumb.
--hk-scroll-width8pxScrollbar thickness.
--hk-scroll-fade2remHeight of the edge fade.

Accessibility

  • The region is focusable and keyboard-scrollable — custom scrollbars must not remove that.
  • Fades are aria-hidden decoration and are driven by measured scroll position, never faked as always-on.

More in Layout