Skip to content

Scroll to

The <h-scroll-to> webcomponent is used to scroll to various elements on a page.

Usage requires adding a to property signifying the name of the element that we want to scroll to. Such element must be present in the DOM and have a data-scroll attribute with the exact same value as to attribute.

Attributes

Attribute name Type Default Description
to string null An indicator of an element we want to scroll to
behavior (optional) ScrollBehavior smooth A behavior of the scrolling. More about scroll behaviors here

Example

HTML
<h-scroll-to to="my-element">
    Some content
</h-scroll-to>

<div data-scroll="my-element">
    Element I want to scroll to
</div>