Affix
Pins its children in place once the page scrolls past them, and releases them on the way back.
Harbour rebrand, 7 tasks
Draft launch checklist
ResearchBook crew interviews
OpsIcon audit
DesignOffline sync for tasks
EngHarbour homepage
DesignBrand palette
DesignRota export
OpsDraft launch checklist
ResearchBook crew interviews
OpsIcon audit
DesignOffline sync for tasks
EngHarbour homepage
DesignBrand palette
DesignRota export
OpsPinned
In context
5 projects, 1 late, launch on 24 Oct
Identity, site and launch kit for the harbour trust.
On trackOffline tasks and a quiet inbox for the crew.
ReviewTwelve calls, one clear pattern.
LateShifts out to payroll without the spreadsheet.
DoneWayfinding for the three northern depots.
ReviewProps
| Prop | Type | Required | Default |
|---|---|---|---|
offsetTop | number | undefined | No | 0 |
onAffixChange | ((affixed: boolean) => void) | undefined | No | — |
className | string | undefined | No | — |
Behaviour
A same-sized placeholder keeps the layout from jumping when the content pins. Measurement is rAF-throttled. It listens to the real window scroll, not a scrollable container, so scroll this page to see it pin and un-pin.
data-rebar-* attributes
data-rebar-component="affix" on the root; the pinned content and its placeholder each carry their own data-rebar-part.
Migrating to Ant Design
AntD's Affix is a close direct equivalent: offsetTop maps across, onAffixChange is onChange.