Smart UI Components & Libraries – Grid, Scheduler, Gantt, Kanban for Angular, React, Next.js, Vue, Blazor, JavaScript › Forums › Editor & Inputs › Can someone clarify how to configure: Editor?
- This topic has 1 reply, 2 voices, and was last updated 1 week, 4 days ago by
Markov.
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
December 31, 2025 at 4:46 am #113309
natejacobson
ParticipantHow can I add custom dropdowns in Smart Editor toolbar in web app?
January 8, 2026 at 6:30 pm #113323Markov
KeymasterHi,
Smart.Editor lets you add custom toolbar items by defining toolbarItems entries as objects with a template (string or function). Your template can create and mount any Smart UI component (including dropdowns) inside the toolbar.
htmlelements.com1) Add a custom dropdown to the main toolbar <smart-editor id="editor"></smart-editor> const editor = document.getElementById('editor'); editor.toolbarItems = [ 'bold', 'italic', 'underline', '|', { name: 'mySnippetsDropdown', width: 180, template: (element, item) => { // Create once, reuse (prevents duplicates on rerender) if (!element.customElement) { const ddl = document.createElement('smart-drop-down-list'); ddl.placeholder = 'Insert…'; ddl.selectionMode = 'one'; ddl.dataSource = [ { label: 'Signature', value: 'Best regards,<br>Boyko' }, { label: 'Meeting notes header', value: '<h3>Meeting Notes</h3><hr>' }, { label: 'Callout', value: '<div class="callout">Tip: …</div>' } ]; ddl.addEventListener('change', (e) => { const selected = e.detail?.value; if (!selected) return; // Insert at caret (pick the API you use in your app) // Common patterns: editor.insertHTML(...), editor.value += ..., or execCommand. if (typeof editor.insertHTML === 'function') { editor.insertHTML(selected); } else { // Fallback if you manage the content yourself: editor.value = (editor.value || '') + selected; } // Reset selection (optional) ddl.selectedIndexes = []; }); element.customElement = ddl; } if (!element.contains(element.customElement)) { element.appendChild(element.customElement); } } }, '|', 'undo', 'redo' ];Hope this helps.
Best regards,
MarkovSmart UI Team
https://www.htmlelements.com/ -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.