Class ColorItemBase
A class used for configuring the font or background color properties in the SfRichTextEditor.
Namespace: Syncfusion.Blazor.RichTextEditor
Assembly: Syncfusion.Blazor.dll
Syntax
public class ColorItemBase : OwningComponentBase
Constructors
ColorItemBase()
Declaration
public ColorItemBase()
Properties
ColorCode
Gets or sets the color code in the color picker palette for content background and font color.
Declaration
public Dictionary<string, string[]> ColorCode { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.String[]> | A dictionary representing the color codes, where the key is the category and the value is an array of color codes. |
Remarks
Passing string.Empty
as a value in the array will display it as a transparent color in the palette.
Columns
Gets or sets the number of columns that is displayed on a row in the color picker palette.
Declaration
public int Columns { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of columns that is displayed in the color picker palette. The default value is |
Default
Specifies the color value that is displayed by default in the color picker.
Declaration
public virtual string Default { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string representing the default color value. |
Mode
Gets or sets the color picker default rendering palette or picker mode.
Declaration
public ColorPickerMode Mode { get; set; }
Property Value
Type | Description |
---|---|
ColorPickerMode | A value from the ColorPickerMode enumeration. The default value is Palette |
Remarks
This property controls how the color picker popup is displayed:
- If the value is
ColorPickerMode.Palette
, the color picker will be displayed as a color palette, allowing users to select colors from a predefined set of colors. - If the value is
ColorPickerMode.Picker
, the color picker will be displayed as a color selection panel, where users can interactively select a color using a more customizable interface (e.g., RGB, HSL sliders, etc.).
ModeSwitcher
Gets or sets a value indicating whether the color picker display mode switcher button is enabled or disabled.
Declaration
public bool ModeSwitcher { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
When set to true
, the color picker will display a button that enables the user to switch between different display modes (such as a palette and picker).
When set to false
, the display mode switcher is hidden or inactive, and the user cannot change the mode interactively.
Parent
A class is used to configure the quick toolbar settings in the Rich Text Editor.
Declaration
protected SfRichTextEditor Parent { get; set; }
Property Value
Type |
---|
SfRichTextEditor |
ShowRecentColors
Gets or sets a value indicating whether the recent colors section is shown in the RichTextEditorFontColor and RichTextEditorBackgroundColor UI.
Declaration
public bool ShowRecentColors { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | A System.Boolean indicating if the recent colors are displayed. The default value is true. |
Remarks
This property enables the section in the RichTextEditorFontColor and RichTextEditorBackgroundColor UI that displays the recently selected colors for quick access.
Using this feature can enhance the user experience by allowing quick re-use of colors that were recently selected, saving time and improving efficiency.
Examples
The following example demonstrates how to use the ShowRecentColors property in a RichTextEditor component:
</SfRichTextEditor> <SfRichTextEditor> <RichTextEditorBackgroundColor ShowRecentColors = "true" /> <RichTextEditorFontColor ShowRecentColors =" true" /> </SfRichTextEditor >
Methods
Dispose(Boolean)
Dispose unmanaged resources in the Syncfusion Blazor component.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | Boolean value to dispose the object. |
GetColorType()
Used to get the Color type.
Declaration
protected virtual string GetColorType()
Returns
Type | Description |
---|---|
System.String | Returns the dropdown type as a string. |
Remarks
Override this method in derived classes to specify the color type.
OnInitializedAsync()
Method invoked when the component is ready to start.
Declaration
protected override Task OnInitializedAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing any asynchronous operation. |
OnParametersSetAsync()
Method invoked when the component has received parameters from its parent.
Declaration
protected override Task OnParametersSetAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing any asynchronous operation. |
Remarks
This method is responsible for detecting and reacting to property changes from the parent component.
PropertyChangeHandler(Dictionary<String, Object>.KeyCollection)
Used to handle the dynamic property changes.
Declaration
protected virtual void PropertyChangeHandler(Dictionary<string, object>.KeyCollection keys)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary.KeyCollection<> | keys | Specifies the changed keys. |
Remarks
This method can be overridden to customize the handling of dynamic property changes.