Table of Contents

Class MudScrollToTop

Namespace
MudBlazor
Assembly
MudBlazor.dll

A button which lets the user jump to the top of the page.

public class MudScrollToTop : MudComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged, IDisposable
Inheritance
MudScrollToTop
Implements
Inherited Members
Extension Methods

Constructors

MudScrollToTop()

public MudScrollToTop()

Properties

ChildContent

The content within this button.

[Parameter]
[Category("Behavior")]
public RenderFragment? ChildContent { get; set; }

Property Value

RenderFragment

Classname

The CSS classes applied to this component.

protected string Classname { get; }

Property Value

string

HiddenCssClass

The CSS classes applied when Visible becomes false.

[Parameter]
[Category("Appearance")]
public string? HiddenCssClass { get; set; }

Property Value

string

Remarks

This is typically set to transition and animation CSS classes. Multiple classes must be separated by spaces.

OnClick

Occurs when the scroll-to-top button is clicked.

[Parameter]
public EventCallback<MouseEventArgs> OnClick { get; set; }

Property Value

EventCallback<MouseEventArgs>

OnScroll

Occurs when the page is scrolled.

[Parameter]
public EventCallback<ScrollEventArgs> OnScroll { get; set; }

Property Value

EventCallback<ScrollEventArgs>

ScrollBehavior

The scroll behavior when the scroll-to-top button is clicked.

[Parameter]
[Category("Behavior")]
public ScrollBehavior ScrollBehavior { get; set; }

Property Value

ScrollBehavior

Remarks

Defaults to Smooth.

Selector

The CSS selector to which the scroll event will be attached.

[Parameter]
[Category("Behavior")]
public string? Selector { get; set; }

Property Value

string

TopOffset

The number of pixels scrolled before the scroll-to-top button becomes visible.

[Parameter]
[Category("Behavior")]
public int TopOffset { get; set; }

Property Value

int

Remarks

Defaults to 300 (300 pixels).

Visible

Displays this button.

[Parameter]
[Category("Behavior")]
public bool Visible { get; set; }

Property Value

bool

Remarks

Defaults to false. When false, this will become true once the user scrolls down the number of pixels in TopOffset.

VisibleCssClass

The CSS classes applied when Visible becomes true.

[Parameter]
[Category("Appearance")]
public string? VisibleCssClass { get; set; }

Property Value

string

Remarks

This is typically set to transition and animation CSS classes. Multiple classes must be separated by spaces.

Methods

BuildRenderTree(RenderTreeBuilder)

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

Dispose()

Releases resources used by this component.

public void Dispose()

OnAfterRender(bool)

protected override void OnAfterRender(bool firstRender)

Parameters

firstRender bool