Omu.BlazorAwesome
1.3.1
dotnet add package Omu.BlazorAwesome --version 1.3.1
NuGet\Install-Package Omu.BlazorAwesome -Version 1.3.1
<PackageReference Include="Omu.BlazorAwesome" Version="1.3.1" />
paket add Omu.BlazorAwesome --version 1.3.1
#r "nuget: Omu.BlazorAwesome, 1.3.1"
// Install Omu.BlazorAwesome as a Cake Addin #addin nuget:?package=Omu.BlazorAwesome&version=1.3.1 // Install Omu.BlazorAwesome as a Cake Tool #tool nuget:?package=Omu.BlazorAwesome&version=1.3.1
Blazor Awesome Components
Live demo: blazor.aspnetawesome.com
Installation: aspnetawesome.com/learn/blazor/Installation
Demos downloads: Blazor Server Blazor Wasm
Getting started
(Installation and DropdownList tutorial)
- Install the library into your blazor project as shown here
- In your blazor page (Home.razor for example) add this code:
<OButton>hi</OButton>
<ODropdownList @bind-Value="input.Dropdown1" Opt="opt" />
<ODropdownList TKey="int" Opt="opt" />
@code {
private InputModel input = new();
private DropdownOpt opt = new DropdownOpt
{
Data = new KeyContent[]
{
new KeyContent(1, "apple"),
new KeyContent(2, "banana"),
new KeyContent(3, "cherry"),
}
};
class InputModel
{
public int? Dropdown1 { get; set; }
}
}
- Hit
Ctrl+F5
in Visual Studio and try the Button and the 2 DropdownLists.
Open a popup
- In your
@code
section add this:
private OPopup popup1;
- In the markup add this:
<br />
<OPopup @ref="popup1" Opt="@(new(){ Modal = true, Title = "My Modal Popup", OutClickClose = true })">
<div style="min-width: 30vw; padding: 1em;">
Modal popup content
</div>
</OPopup>
<OButton OnClick="() => popup1.Open()">Open popup</OButton>
- Hit
Ctrl+F5
and try clicking theOpen popup
button.
Grid with column filter
- Add this to your markup:
<br />
<br />
<OGrid Opt="gopt" />
- Add this to you
@code
section
private GridOpt<Lunch> gopt = new();
protected override void OnInitialized()
{
initGrid();
}
private void initGrid()
{
gopt.ContentHeight = 250;
gopt.KeyProp = m => m.Id;
gopt.GetQuery = () => new Lunch[]
{
new Lunch { Id = 1, Name = "apple"},
new Lunch { Id = 2, Name = "banana"},
new Lunch { Id = 3, Name = "cherry"},
}.AsQueryable();
gopt.FilterRow = true;
gopt.Column(new()
{
For = m => m.Id,
Width = 100
});
gopt.Column(new()
{
For = m => m.Name
})
.StringFilter(gopt, this);
}
class Lunch
{
public int Id { get; set; }
public string Name { get; set; }
}
- Hit
Ctrl + F5
, and try the grid, you can sort, group, filter by the Name Column, and pick your columns from the bottom corner menu.
Multiselect, Multicheck and Combobox
We can reuse the opt
options object from the 1st tutorial "Getting started", to demonstrate other editors.
After the DropdownList paste this code:
<br />
<br />
<OMultiselect TKey="int" Opt="opt" />
<OMulticheck TKey="int" Opt="opt" />
<OCombobox Opt="opt" />
You can use @bind-Value="Prop1"
instead of specifying the TKey
, as shown for the DropdownList, in that case Prop1
could be of type IEnumerable<int>
. The combobox bind-Value
property type should be object
because its value can be either string or the key type.
Video Tutorial
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net7.0
- Microsoft.AspNetCore.Components.Web (>= 7.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.