Skip to main content
2.0.61
Light Dark System
Compact Comfortable

Sidebar

<zn-sidebar> ZnSidebar
Since 1.0 experimental

Sidebars place secondary content in a column beside the main content.

Jane Cooper Pro, monthly

The main content goes in the default slot.

<zn-sidebar caption="Details">
  <div slot="side">
    <zn-sp>
      <zn-item caption="Customer">Jane Cooper</zn-item>
      <zn-item caption="Plan">Pro, monthly</zn-item>
    </zn-sp>
  </div>

  <zn-sp>
    <p>The main content goes in the default slot.</p>
  </zn-sp>
</zn-sidebar>

Put the side column’s content in the side slot and the main content in the default slot. When the sidebar is too narrow for two columns, the side column collapses under a toggle labelled with caption (“Show Details” / “Close Details”).

Examples

Wide Side Column

Add wide for a wider side column.

Today, 09:12 12 Nov 2026

Main content

<zn-sidebar caption="Activity" wide>
  <div slot="side">
    <zn-sp>
      <zn-item caption="Last login">Today, 09:12</zn-item>
      <zn-item caption="Last order">12 Nov 2026</zn-item>
    </zn-sp>
  </div>

  <zn-sp>
    <p>Main content</p>
  </zn-sp>
</zn-sidebar>

Starting at the Bottom

Add start-scrolled to keep the main content scrolled to the bottom as content is added, such as for a chat log. Add open to start with the collapsed side column expanded.

Conversation details

First message

Second message

Third message

Fourth message

Latest message

<div style="height: 200px;">
  <zn-sidebar caption="Info" start-scrolled>
    <div slot="side">
      <zn-sp>Conversation details</zn-sp>
    </div>

    <zn-sp>
      <p>First message</p>
      <p>Second message</p>
      <p>Third message</p>
      <p>Fourth message</p>
      <p>Latest message</p>
    </zn-sp>
  </zn-sidebar>
</div>

Slots

Name Description
(default) The default slot.