Affix

Pins content to a viewport or scroll container edge.

Affix

Viewport pinning

Without target, Affix listens to the page. Content pins to the viewport top after it reaches offset-top.

Custom content

The default slot can pin a toolbar, filter row, status, or any other component.

API

PROPS

Property
Type
Values
Description
default
Example
More
offset-top
Number
pixels
Distance from the top edge before the content is pinned.
0
—
offset-bottom
Number
pixels
Pin content to the bottom edge instead of the top.
—
—
target
Function
() => HTMLElement | Window
Scroll target. Use a container element for local pinning.
window
—
z-index
Number
number
Stacking order while pinned.
100
—

EVENTS

Event
Type
Description
default
Example
More
change
—
Fires when the pinned state changes. Receives a boolean.
—
—

SLOTS

Slot
Scope
Description
default
Example
More
default
any content
Content that should be pinned.
—
—
Last Updated: 2026-10-28, 06:17:56 UTC
Copied