Kebechet.Blazor.Components.BottomSheet 1.1.7

Prefix Reserved
dotnet add package Kebechet.Blazor.Components.BottomSheet --version 1.1.7                
NuGet\Install-Package Kebechet.Blazor.Components.BottomSheet -Version 1.1.7                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kebechet.Blazor.Components.BottomSheet" Version="1.1.7" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Kebechet.Blazor.Components.BottomSheet --version 1.1.7                
#r "nuget: Kebechet.Blazor.Components.BottomSheet, 1.1.7"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Kebechet.Blazor.Components.BottomSheet as a Cake Addin
#addin nuget:?package=Kebechet.Blazor.Components.BottomSheet&version=1.1.7

// Install Kebechet.Blazor.Components.BottomSheet as a Cake Tool
#tool nuget:?package=Kebechet.Blazor.Components.BottomSheet&version=1.1.7                

Blazor.Components.BottomSheet

This repo contain BottomSheet Blazor component.

Setup

  • Install nuget package Kebechet.Blazor.Components.BottomSheet
  • In your Program.cs add:
builder.Services.AddBottomSheetServices();
  • Ideally in MainLayout.razor put <BottomSheetContainer /> component. This component is controlled from BottomSheetService and it's purpose is to render BottomSheet content.

Usage

  • In component where you would like to render BottomSheet inject service:
@inject BottomSheetService _bottomSheetService
  • Create BottomSheet content component. E.g. OptionBottomSheet.razor that implements interface IBottomSheet in case you don't want to return any value from the BottomSheet or IBottomSheetReturnable<T> with return type T.
    • ⚠️ The child component must have [Parameter] at the beginning of the OnReturnValue property, otherwise it won't work.

Index.razor part

@page "/"
@using BlazorApp11.Components
@using SatisFIT.Client.App.Services
@inject BottomSheetService _bottomSheetService

<PageTitle>Home</PageTitle>

<button class="btn btn-primary" @onclick="Show">Click me</button>

<span>Result: @_selectedValue</span>

@code{
    public int _selectedValue { get; set; } = 0;

    public async Task Show()
    {
        var result = await _bottomSheetService.Show(
            new OptionBottomSheet()
            {
            }
        );

        _selectedValue = result;
    }
}
  • then in your component where you would like to render BottomSheet:
    • inject BottomSheetService
    • add functionality to trigger BottomSheet. In our case button onClick event

OptionBottomSheet.razor

@using Blazor.Components.BottomSheet.Components
@using SatisFIT.Client.App.Services
@inject BottomSheetService _bottomSheetService

<BottomSheet @ref="BottomSheetComponent">
    <FixedContent>
        <span>This is header content</span>
    </FixedContent>

    <Content>
        <input placeholder="write here" />

        @for(int i = 0; i <= 30; i++)
        {
            var index = i;
            <button @onclick="() => ReturnValue(index)">Content btn @index</button>
            <br>
        }
    </Content>
</BottomSheet>

OptionBottomSheet.razor.cd

public partial class OptionBottomSheet : IBottomSheet
{
    [Parameter] public BottomSheet? BottomSheetComponent { get; set; }
    [Parameter] public EventCallback<int> OnReturnValue { get; set; }

    public async Task<bool> CanHideBottomSheet()
    {
        return await Task.FromResult(true);
    }

    public async Task ReturnValue(int number)
    {
        await OnReturnValue.InvokeAsync(number);
    }
}
  • ENJOY 🎉
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.7 306 3/1/2024 1.1.7 is deprecated because it is no longer maintained.
1.1.6 203 2/12/2024
1.1.5 116 2/11/2024
1.1.4 119 2/11/2024
1.1.3 195 1/26/2024
1.1.2 102 1/26/2024
1.1.1 140 1/22/2024
1.1.0 97 1/22/2024
1.0.2 105 1/22/2024
1.0.1 105 1/21/2024
1.0.0 108 1/21/2024

Fixed miss-click and top background