Host tabs add a tab bar above the editor. The first tab is always the visual editor; extra tabs show read-only HTML panels for things like an outline, an editorial brief, or a report.
This example enables two tabs on init: Outline (built from headings in the document) and Brief (a static assignment panel). Edit the article, then open Outline to see the structure update.
<div id="entry-host-tabs"></div>
const briefHtml = `
<div class="demo-host-panel">
<h3>Editorial brief</h3>
<p><strong>Audience</strong> Product managers evaluating remote onboarding tools</p>
<p><strong>Goal</strong> Explain why the first two weeks matter more than a welcome kit</p>
<ul>
<li>Equipment and accounts before day one</li>
<li>A buddy and a 30-60-90 plan</li>
<li>One reusable source of truth</li>
</ul>
</div>
`;
function buildOutlineHtml(content) {
const doc = new DOMParser().parseFromString(content || '', 'text/html');
const headings = [...doc.querySelectorAll('h2, h3')];
if (!headings.length) {
return '<div class="demo-host-panel"><p>No headings yet.</p></div>';
}
const items = headings.map((el) => {
const level = el.tagName.toLowerCase();
const text = (el.textContent || '').trim() || '(empty heading)';
return `<li><strong>${level.toUpperCase()}</strong> ${text}</li>`;
}).join('');
return `<div class="demo-host-panel"><ul>${items}</ul></div>`;
}
const app = Redactor('#entry-host-tabs', {
hostTabs: [
{ key: 'outline', title: 'Outline', html: buildOutlineHtml(initialContent), permanent: true },
{ key: 'brief', title: 'Brief', html: briefHtml, permanent: true }
],
content: initialContent
});
// Keep the Outline tab in sync while the author edits
app.on('editor:change', () => {
app.hostTabs.setContent('outline', buildOutlineHtml(app.getContent()));
});
hostTabs on init to mount the tab bar. The Editor tab is always first; your keys cannot be editor.app.hostTabs.setContent(key, html), or switch tabs with app.hostTabs.setActive('outline').Full option fields: Host tabs setting. Module API: hostTabs.