Default values
If your website follows a normal flow and you have not limited the body or html height, you will not need to do anything to configure it, and the component will behave like the one you've probably already noticed on our website. If you put it at the layout level, it will run on all the pages of your site.
<MudScrollToTop> <MudFab Color="Color.Tertiary" Icon="@Icons.Filled.ArrowCircleUp" /> </MudScrollToTop>
Setup
If the element you want to scroll is other than the root element, you can specify it with the Selector
property. In this example, we are going to scroll in the container marked with the selector #unique_id_scroll_section
. Notice how the button that appears at the bottom right of this container when you scroll changes its color.
Scroll inside this container
Some initial long text
Middle text
Bottom text
Custom content
In the example above, we have used a MudButton as a trigger for the back to top action, but we could have used pretty much anything. The root element of the component is just a transparent span element that allows you to use anything inside. In the next example we show you how to use a custom button, with custom transitions to show and hide.