Smooth Scroll (lerp)

`<pura-smooth-scroll>` is the signature awwwards move: smoothed whole-page scrolling via interpolation (lerp), in the spirit of Lenis, GSAP ScrollSmoother and Locomotive Scroll. Wrap your page content and wheel, touch and scrollbar input become fluid movement with inertia. The technique is pure progressive enhancement: SSR renders the children in normal flow with native scroll intact; on connect the content becomes a fixed, transform-driven layer, a spacer keeps the document at the real height (so the native scrollbar, keyboard scrolling and assistive tech keep working), and a rAF loop lerps a translate toward the native scroll position. The loop idles when settled, so an unmoving page costs zero frames. `lerp` tunes the inertia, `horizontal` maps the vertical scrollbar to sideways movement, and `scrollTo(target, { offset, duration, easing })` gives you eased programmatic scrolling to a pixel value, selector or element. A `pura-smooth-scroll` event fires each frame while moving with `{ scroll, targetScroll, velocity, progress }`, handy for syncing parallax or progress UI. Reduced motion never activates the effect and the page scrolls natively. Each instance registers in `window.__puraSmoothScrolls` by `data-pura-id` with `{ lerp, horizontal, scrollTo }`, and `data-pura-ss-*` attributes mirror config and live progress. Note: the component is designed to wrap the entire page content, and anchor jumps inside the smoothed layer should go through `scrollTo`.

Preview

Attributes

AttributeTypeDefaultDescription
lerp number 0.1 Interpolation factor per frame at 60fps, 0 to 1. Lower is floatier; 1 follows the scrollbar exactly.
horizontal boolean false Map the vertical scrollbar and wheel to horizontal movement of the content.
duration number 1000 Default duration in milliseconds for programmatic scrollTo().
offset number 0 Default pixel offset applied by scrollTo(); negative stops short of the target, e.g. for a fixed header.
disabled boolean false Keep native scrolling, no smoothing. Toggle at runtime to stop and start the effect.

Installation

pura is copy-paste and dependency-free. Load the whole library, or just this component.

HTML
<link rel="stylesheet" href="/pura/tokens.css">
<script type="module" src="/pura/lib/smooth-scroll.js"></script>
JavaScript
import "./pura/lib/smooth-scroll.js";

Slots

default

Events

pura-smooth-scroll
esc
AccordionDisclosure ActionAgent AffixLayout Agent CursorTools Agent HintAgent Alert DialogOverlay AlertFeedback Angle SliderForm Animated BeamAnimation App ShellLayout Aspect RatioDisplay AsyncAgent AudioDisplay AuroraDisplay Auto AnimateUtility Avatar GroupDisplay AvatarDisplay Back to TopNavigation BadgeDisplay BannerFeedback BarcodeDisplay Background BeamsAnimation Bento GridAnimation Gooey BlobsAnimation BlockquotePrimitives Blur TextAnimation Border BeamDisplay Bottom NavigationNavigation BoxPrimitives BreadcrumbNavigation BubblesAnimation BurgerNavigation Button GroupForm ButtonForm CalendarDate Card StackAnimation CardDisplay CarouselLayout CascaderForm CenterPrimitives ChartDisplay Chat BubbleDisplay Chat InputForm CheckboxForm Cipher HoverAnimation Circular TextAnimation Click SparkAnimation Clip RevealAnimation Code BlockDisplay CodePrimitives CollapsibleDisclosure Color PickerForm ComboboxForm Command RegistryAgent CommandNavigation CommentDisplay ConfettiAnimation Confidence MeterDisplay Container ScrollAnimation ContainerLayout Context MenuOverlay Cookie ConsentOverlay Copy ButtonDisplay Copy RegionAgent Count UpDisplay CountdownFeedback Coverflow CarouselAnimation CronForm CrosshairAnimation CursorAnimation Data TableDisplay Date PickerDate Date Range PickerDate Datetime PickerDate DeckAnimation DialogOverlay Diff MotionUtility DiffUtility Direction HoverAnimation DisclosureLayout DockNavigation Dot PatternAnimation DrawAnimation DrawerOverlay Dropdown MenuOverlay Dynamic IslandAnimation EmphasisUtility EmptyDisplay Expand CardAnimation ExplainAgent Floating Action ButtonLayout Falling TextAnimation FAQDisclosure FieldForm File DropzoneForm FireworksAnimation FlashlightAnimation FlexPrimitives Flickering GridAnimation Flip CardAnimation Floating WindowOverlay Flow FieldAnimation FlowDisplay Fly To CartAnimation Focus HoverAnimation FolderAnimation FormForm Fuzzy TextAnimation Gallery 3DAnimation GaugeDisplay Glitch TextAnimation Gooey CursorAnimation Gradient TextAnimation Grid MotionAnimation Grid PatternDisplay GridPrimitives HeadingPrimitives HeatmapDisplay Hide-on-scroll BarAnimation HighlightDisplay Hold ConfirmAnimation Holo CardAnimation HotkeyAgent Hover CardOverlay Hover HighlightAnimation Hover UnderlineAnimation IconDisplay IdleAgent Image CompareLayout Image TrailAnimation ImagePrimitives Infinite ScrollUtility Inline EditForm Input GroupForm Input OTPForm InputForm InspectorUtility IntentAgent Interactive GridAnimation ItemDisplay Json InputForm KanbanLayout Keyboard ShortcutsOverlay KbdDisplay KnobForm LabelForm Lamp EffectAnimation LensAnimation Letter ShuffleAnimation Light RaysAnimation LightboxOverlay Line Shadow TextAnimation LinkPrimitives ListDisplay Live RegionAgent Magic CardDisplay Magnet LinesAnimation MagneticAnimation MapDisplay Markdown EditorForm Marquee 3DAnimation MarqueeDisplay Mask InputForm MasonryLayout Matrix RainAnimation Media QueryUtility MentionForm MenubarNavigation Animated Mesh GradientAnimation MeteorsDisplay MeterDisplay MorphAnimation Motion BudgetUtility Motion PathAnimation MotionUtility Narrated TransitionUtility Navigation MenuNavigation Noise / Film GrainAnimation Notification ItemDisplay Number InputForm OptimisticAgent Orbiting CirclesDisplay Organization ChartDisplay Overflow ListLayout OverlayOverlay PaginationNavigation Parallax ColumnsAnimation ParallaxMarketing Particle NetworkAnimation ParticlesDisplay Password InputForm Pdf ViewerDisplay Scroll PinAnimation Pinch ZoomAnimation Pixel RevealAnimation Pointer ParallaxAnimation PopconfirmOverlay PopoverOverlay PortalAgent PresenceDisplay Pricing TableMarketing Progress RingDisplay ProgressDisplay Progressive BlurAnimation TypographyDisplay Pull To RefreshFeedback Pulse RingsAnimation Qr CodeUtility Radio GroupForm RadioForm Range SliderForm RatingForm ReactionsDisplay RedactAgent ResizableLayout ResultFeedback Retro GridDisplay RevealUtility Rich TextForm RippleUtility ScrambleAnimation Scroll AreaNavigation Scroll HighlightAnimation Infinite Scroll LoopAnimation Scroll ProgressNavigation Scroll RevealUtility Scroll SpyNavigation Scroll TimelineUtility Scroll ZoomAnimation Search FieldForm SectionPrimitives Segmented ControlForm SelectForm SeparatorDisplay Sheen / Glare HoverAnimation SheetOverlay SidebarNavigation SignatureForm Skeleton TextDisplay SkeletonDisplay Skip NavNavigation SliderForm Smooth Scroll (lerp)Animation SnowAnimation SortableAnimation SpacerPrimitives Sparkles TextAnimation SparklineDisplay Speed DialOverlay SpinnerDisplay Split ButtonOverlay Split-Flap TextAnimation Split TextAnimation SpotlightOverlay SpringAnimation StackPrimitives StageAnimation Starfield / HyperspaceAnimation Stat GridDisplay StatDisplay Status BadgeAnimation Step LoaderAnimation StepperNavigation Sticky Scroll RevealAnimation Stream CascadeUtility Swatch PickerForm SwipeUtility SwitchForm TableDisplay TabsNavigation Tag InputForm TagDisplay TerminalDisplay TestimonialDisplay Text FillAnimation Text HighlighterAnimation Morphing TextAnimation Text PressureAnimation Text ShimmerDisplay TextPrimitives TextareaForm Theme DesignerUtility Animated Theme ToggleAnimation TickerDisplay TiltAnimation Time PickerDate Time ScrubUtility TimelineDisplay ToastFeedback Toggle GroupForm ToggleForm ToolbarNavigation TooltipOverlay TourOverlay Tracing BeamAnimation TransferForm Tree SelectForm Tree ViewDisplay True FocusAnimation TruncateUtility Type MorphAnimation TypewriterDisplay Typing IndicatorFeedback UndoFeedback UploadForm Vanish InputAnimation Scroll Velocity MarqueeAnimation VelocityAnimation Video TextAnimation VideoDisplay View TransitionUtility Virtual ListDisplay Visually HiddenPrimitives WatermarkDisplay Wavy BackgroundAnimation Wavy TextAnimation WipeAnimation Word RotateAnimation