Example of Type in ASP.NET MVC Rich Text Editor Control
This sample demonstrates the different behavior of toolbar support in the Rich Text Editor. Change the toolbar type as multiRow or expand from the property panel to see its appearance. Check or uncheck the floating toolbar in property panel to view its behavior.
@Html.UiRichTextEditor(new UiRichTextEditorOptions
{
Id = "typeEditor",
Name = "Type",
Height = "280px",
Width = "560px",
ToolbarSettings = new UiRichTextToolbar
{
Type = UiRichTextToolbarType.Expand,
Items = (List<string>)ViewData["Tools"]
},
Value = (string)ViewData["RTEValue"]
})
<div class="rte-actions">
<label>Type
<select id="rteToolbarType" class="form-select form-select-sm"><option>Expand</option><option>MultiRow</option><option>Scrollable</option></select>
</label>
</div>
@Html.UiRichTextEditor(new UiRichTextEditorOptions
{
Id = "typeEditor",
Name = "Type",
Height = "280px",
Width = "560px",
ToolbarSettings = new UiRichTextToolbar
{
Type = UiRichTextToolbarType.Expand,
Items = (List<string>)ViewData["Tools"]
},
Value = (string)ViewData["RTEValue"]
})
<style>
.rte-actions { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 12px; }
.rte-actions label { display: flex; align-items: center; gap: 6px; }
</style>
<script>
(function () {
'use strict';
document.addEventListener('change', function (event) {
if (event.target.id !== 'rteToolbarType') { return; }
window.Lumen.get('typeEditor').setToolbarType(event.target.value);
});
})();
</script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Lumen.UI.Mvc;
namespace YourApp.Controllers
{
public class RichTextEditorController : Controller
{
// The page is Views/RichTextEditor/Type.cshtml; it draws what ViewData holds.
public ActionResult Type()
{
ViewData["RTEValue"] = "<p>This toolbar has more tools than fit in 560 pixels.</p>";
ViewData["Tools"] = new List<string> { "Bold", "Italic", "Underline", "StrikeThrough", "|", "Formats", "Alignments", "|", "OrderedList", "UnorderedList", "Indent", "Outdent", "|", "CreateLink", "CreateTable", "HorizontalLine", "|", "SubScript", "SuperScript", "ClearFormat", "|", "SourceCode", "FullScreen", "|", "Undo", "Redo" };
return View();
}
}
}
@* Install once: Install-Package Lumen.UI.Mvc (or: dotnet add package Lumen.UI.Mvc) *@
@* Views/Web.config: <add namespace="Lumen.UI.Mvc" /> *@
@* Views/Shared/_Layout.cshtml *@
<head>
@Html.UiStyles()
<link rel="stylesheet" href="~/Content/site.css" />
</head>
<body>
@RenderBody()
@Html.UiScripts()
@RenderSection("scripts", required: false)
</body>
The Rich Text Editor allows you to configure different types of toolbar using toolbarSettings.type property. The types of toolbar are:
Expand: The toolbar hides the overflowing items in the next row. Click the expand arrow to view overflowing toolbar items.Multi Row: The toolbar hides the overflowing items in the next row.Floating: set boolean value to toolbarSettings.enableFloating property to enable or disable the floating toolbar.Scrollable: All the elements are displayed in a single line with horizontal scrolling enabled.Popup: The toolbar hides the overflowing items inside a popup menu when there is limited space. The popup menu is displayed when clicking the toolbar overflow icon.