RfDropDown creates a Bulma dropdown that supports searching and manages the selection of an item.
When not to Use
Don't use RfDropDown when:
-
When using static rendering mode. Instead use
InputSelect.
A searchable drop down with one selection
RfDropDown creates a Bulma dropdown that supports searching and manages the selection of an item.
Don't use RfDropDown when:
InputSelect.
The RfDropDown works primarily with two parameters: SelectedItem and Items.
The dropdown doesn't make any assumptions on how to render the items or selected item it is given.
Instead the drop down supports three RenderFragement to customize the way an item appears within the drop down.
All three RenderFragement have a context of TItem and are used to setup two sections.
The two sections of the drop down that can be custimized are RowItemTemplate and SelectedItemTemplate.
The RowItemTempalte directly sets each row or option of the drop down. Each row is wrapped in the following code:
@RowItemTemplate(item)
If RowItemTemplate isn't set the drop down will use ChildContent.
When the drop down has a selection it calls the SelectedItemTemplate to render the TItem within the input portion of the drop down.
The selected item is wrapped in the following code:
@SelectedItemTemplate(SelectedItem)
If SelectedItemTemplate isn't set the drop down will use ChildContent.
Setting up RForge is simple. Follow the below steps to add RForge Blazor components to your project.
RForge Blazor components are installed via Nuget. There are two packages. One for the blazor app and one for the library if any.
dotnet add package RForge.Blazor
Install-Package RForge.Blazor
This is optional but may be useful if you want to use common enums across the backend and frontend.
dotnet add package RForge.Abstractions
Install-Package RForge.Abstractions
To simplify namespacing while using RForge,
the package is designed with most all components sitting within the root RForge namespace.
You may want to include the following namespaces in your _import.razor for ease of use.
@using RForgeBlazor
@using RForgeBlazor.Services
@using RForge.Abstractions
| Namespace | Purpose |
|---|---|
RForgeBlaozr |
Houses all of the blazor components. |
RForgeBlaozr.Services |
Houses interfaces you may need to communicate with certain components. |
RForgeBlaozr.Abstractions |
Common enums used through out the components. |
In order for some components to work they must first have their services registered.
Open up Program.cs and add the following line before the var app = builder.Build();.
using RForgeBlazor;
//...
builder.Services.AddRfForgeBlazorServices();
//...
var app = builder.Build();
RForge makes use of Bulma CSS to stylize the components. Add / install Bulma and add the CSS file to the head. Link to download: Bulma releases.