Kebechet.Blazor.Components.BottomSheet
1.1.6
Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Kebechet.Blazor.Components.BottomSheet --version 1.1.6
NuGet\Install-Package Kebechet.Blazor.Components.BottomSheet -Version 1.1.6
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.6" />
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.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Kebechet.Blazor.Components.BottomSheet, 1.1.6"
#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.6 // Install Kebechet.Blazor.Components.BottomSheet as a Cake Tool #tool nuget:?package=Kebechet.Blazor.Components.BottomSheet&version=1.1.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 fromBottomSheetService
and it's purpose is to renderBottomSheet
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 interfaceIBottomSheet
in case you don't want to return any value from theBottomSheet
orIBottomSheetReturnable<T>
with return typeT
.- ⚠️ The child component must have
[Parameter]
at the beginning of theOnReturnValue
property, otherwise it won't work.
- ⚠️ The child component must have
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 buttononClick
event
- inject
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 | Versions 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.
-
net8.0
- Microsoft.AspNetCore.Components.Web (>= 8.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Fixed iOS Safari blur