Class RichTextEditorLineHeight
Represents the configuration for the line height dropdown in the SfRichTextEditor toolbar. Defines the predefined line heights that populate the Line Height dropdown. Supports customization of default value,custom values from pasted content, and dropdown items.
Inheritance
Inherited Members
Namespace: Syncfusion.Blazor.RichTextEditor
Assembly: Syncfusion.Blazor.dll
Syntax
public class RichTextEditorLineHeight : DropDownButtonItemBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Remarks
This example demonstrates configuring the line height dropdown within the Rich Text Editor.
Examples
@using Syncfusion.Blazor.RichTextEditor
<SfRichTextEditor>
<RichTextEditorToolbarSettings Items="@Tools" />
<RichTextEditorLineHeight Items="@LineHeightItems" Default="1.5" SupportAllValues="true" />
</SfRichTextEditor>
@code {
private List<ToolbarItemModel> Tools = new()
{
new ToolbarItemModel() { Command = ToolbarCommand.LineHeight }
};
private List<DropDownItemModel> LineHeightItems = new()
{
new DropDownItemModel { Text = "Default", Value = "" },
new DropDownItemModel { Text = "1", Value = "1" },
new DropDownItemModel { Text = "1.5", Value = "1.5" },
new DropDownItemModel { Text = "2", Value = "2" }
};
}
Constructors
RichTextEditorLineHeight()
Declaration
public RichTextEditorLineHeight()
Properties
Items
Specifies the set of line height options displayed in the dropdown.
Declaration
[Parameter]
public override List<DropDownItemModel>? Items { get; set; }
Property Value
| Type | Description |
|---|---|
| List<DropDownItemModel> | An IEnumerable<T> containing the line height options. The default value is a predefined collection: [{ Text: "Default", Value: "" }, { Text: "1", Value: "1" }, { Text: "1.15", Value: "1.15" }, { Text: "1.5", Value: "1.5" }, { Text: "2", Value: "2" }, { Text: "2.5", Value: "2.5" }, { Text: "3", Value: "3" }]. |
Overrides
Remarks
Each item should have Text for display and Value for the CSS line-height (numeric string).
Custom items can be added; order affects dropdown appearance. Empty collection results in no dropdown options.
For performance, limit to 10-15 items to avoid UI lag in large toolbars.
Examples
Customizes the items collection.
@code {
private List<DropDownItemModel> LineHeightItems = new List<DropDownItemModel>
{
new DropDownItemModel { Text = "Normal", Value = "1.15" },
new DropDownItemModel { Text = "Double", Value = "2" }
};
}
<RichTextEditorLineHeight Items="@LineHeightItems" />
SupportAllValues
Indicates whether to support all numeric line height values from pasted or imported content.
Declaration
[Parameter]
public bool SupportAllValues { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | A bool indicating support for custom line heights. The default value is false. |
Remarks
When true, non-predefined values are retained and shown as "Custom: {value}" in the dropdown.
Useful for preserving formatting from external sources; may increase dropdown complexity with many unique values.
No thread safety issues; property is set during component initialization.
Methods
Dispose(bool)
Dispose unmanaged resources in the Syncfusion Blazor component.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing | Boolean value to dispose the object. |
Overrides
GetDropDownType()
Used to get the line height type for dropdown configuration.
Declaration
protected override string GetDropDownType()
Returns
| Type | Description |
|---|---|
| string | Returns the line height dictionary key. |
Overrides
PropertyChangeHandler(KeyCollection)
Used to handle the dynamic property changes.
Declaration
protected override void PropertyChangeHandler(Dictionary<string, object>.KeyCollection keys)
Parameters
| Type | Name | Description |
|---|---|---|
| Dictionary<string, object>.KeyCollection | keys | Specifies the changed keys. |