← Back

Scroll Anchor

Viewport.init [intermediate]

Viewport overflow_anchor: follow-tail pinning that releases when you scroll up

Scroll Anchor Demo

Viewport overflow_anchor: follow-tail pinning that releases when you scroll up

For the full interactive experience:

$ mix raxol.playground

Code
seed = Enum.map(1..@seed_count, &log_line/1)

{:ok, vp} =
  Viewport.init(
    id: :scroll_anchor_log,
    children: seed,
    scroll_top: max(0, @seed_count - @visible_height),
    visible_height: @visible_height,
    show_scrollbar: true,
    overflow_anchor: :auto
  )
demo j/k prev/next / focus demo esc back 38/42 demos