Skip to content

skordesign/Blazor.OutsideClickHandler

Repository files navigation

SkorBlazor.OutsideClickHandler

Detect click outside of element for Blazor

Using

1.Install Nuget package or build this project and add reference.

Nuget: SkorBlazor.OutsideClickHandler

2.Add to _ViewImports.cshtml

@addTagHelper *, SkorBlazor.OutsideClickHandler

3.Use it in *.cshtml files

 <OutsideHandleContainer OnClickOutside=@OnClickOutside>
    ...
    <div>Sample element</div>
    ...
</OutsideHandleContainer>

@functions{
    void OnClickOutside()
    {
        // Do stuff
    }
}
Note: If you need more method for this package, feel free to create issue on this repository.