Class MentionFieldSettings
Specifies field mapping settings for the SfMention
component to control which properties of a data source are used for the value, text, icon, group, or disabled state of each mention suggestion item.
Inheritance
Namespace: Syncfusion.Blazor.DropDowns
Assembly: Syncfusion.Blazor.dll
Syntax
public class MentionFieldSettings : OwningComponentBase
Remarks
Use MentionFieldSettings
to connect your data model to the fields required by the Syncfusion Mention component. You typically use this when binding to a collection of objects where the mention needs to display specific text, value, or grouping sourced from your data.
Examples
This example demonstrates using MentionFieldSettings
to map the ID
property as the item's value and the Text
property as the display text:
<SfMention TItem="Games" DataSource="@GamesData">
<ChildContent>
<MentionFieldSettings Value="ID" Text="Text"/>
</ChildContent>
<TargetComponent>
<div id="mentionTarget"></div>
</TargetComponent>
</SfMention>
@code{
public class Games {
public string ID { get; set; }
public string Text { get; set; }
}
List<Games> GamesData = new List<Games> {
new Games() { ID = "Game1", Text = "American Football" },
new Games() { ID = "Game2", Text = "Badminton" },
new Games() { ID = "Game3", Text = "Basketball" },
new Games() { ID = "Game4", Text = "Cricket" },
new Games() { ID = "Game5", Text = "Football" },
new Games() { ID = "Game6", Text = "Golf" }
};
}
Constructors
MentionFieldSettings()
Declaration
public MentionFieldSettings()
Properties
Disabled
Gets or sets a property name that determines whether a particular mention item is disabled and cannot be selected.
Declaration
public string Disabled { get; set; }
Property Value
Type | Description |
---|---|
System.String | The property name in your data model that evaluates to true for disabled items. Default: |
Remarks
If this is set, and an item's value resolves to true
, the item is rendered as disabled and cannot be selected.
GroupBy
Gets or sets the field from your data source that determines group headers in the suggestion list.
Declaration
public string GroupBy { get; set; }
Property Value
Type | Description |
---|---|
System.String | The property name that provides group information for suggestion grouping. If |
Remarks
Grouping is optional. When provided, items with the same group value are displayed under a common header in the mention popup.
IconCss
Gets or sets the property to use for retrieving an icon CSS class for each mention item.
Declaration
public string IconCss { get; set; }
Property Value
Type | Description |
---|---|
System.String | The property name in your model supplying CSS class names for icons. If not set, no icons are shown by default. |
Remarks
This allows you to visually decorate mention items with icons based on underlying data.
Text
Gets or sets the field from your data source that will be displayed as the visible text in the suggestion list.
Declaration
public string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String | The property name that provides the display text for mention items. Required. Default: |
Remarks
Set this to the data property whose value you want shown as the mention label in the popup list.
Value
Gets or sets the field from your data source that provides the value of the mention item when selected.
Declaration
public string Value { get; set; }
Property Value
Type | Description |
---|---|
System.String | The property name that provides the actual value returned to your app when a mention item is chosen. Required. Default: |
Remarks
Set this to the data property that should serve as the mention's unique identifier or value for model binding.
Methods
Dispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
OnInitializedAsync()
Declaration
protected override Task OnInitializedAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |