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
Classname
The CSS classes applied to this component.
protected string Classname { get; }
Property Value
HiddenCssClass
The CSS classes applied when Visible becomes false
.
[Parameter]
[Category("Appearance")]
public string? HiddenCssClass { get; set; }
Property Value
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
OnScroll
Occurs when the page is scrolled.
[Parameter]
public EventCallback<ScrollEventArgs> OnScroll { get; set; }
Property Value
ScrollBehavior
The scroll behavior when the scroll-to-top button is clicked.
[Parameter]
[Category("Behavior")]
public ScrollBehavior ScrollBehavior { get; set; }
Property Value
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
TopOffset
The number of pixels scrolled before the scroll-to-top button becomes visible.
[Parameter]
[Category("Behavior")]
public int TopOffset { get; set; }
Property Value
Remarks
Defaults to 300
(300 pixels).
Visible
Displays this button.
[Parameter]
[Category("Behavior")]
public bool Visible { get; set; }
Property Value
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
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