Split view
A list and the details of what you picked: an inbox, contacts, tickets, settings. Side by side when there is room, with a divider you can drag; one screen at a time on phones, where the details slide in and the phone's own Back returns to the list.
List and details
Click a message. Drag the line between the two sides to resize the list (double click it to reset).
Hi! Could you send my order to my office instead? The address is Rua das Flores 12, Lisbon.
Thanks, Ana
MR Marco Rossi Loved the linen tote Just wanted to say thank you: the tote arrived yesterday and it is perfect. Will order again!Just wanted to say thank you: the tote arrived yesterday and it is perfect. Will order again!
LF Lena Fischer Refund for #10419 The shirt was too small, so I sent it back on Monday. When will the refund arrive?The shirt was too small, so I sent it back on Monday. When will the refund arrive?
SO Sam Okafor Wholesale prices We run a small shop in Lagos and would like to stock your bags. Do you offer wholesale prices?We run a small shop in Lagos and would like to stock your bags. Do you offer wholesale prices?
PN Priya Nair Stock update The new canvas bags arrived at the warehouse: 120 in total. I have updated the stock.The new canvas bags arrived at the warehouse: 120 in total. I have updated the stock.
Message
<div class="split" data-momo-split data-persist="docs-inbox" style="--split-height: 26rem" id="split-inbox">
<div class="split-list" aria-label="Messages">
<a class="split-item is-unread" href="#m1" data-id="m1" data-title="Order #10421: new address">
<span class="avatar avatar-sm bg-pink">AK</span>
<span class="split-item-body">
<span class="split-item-title"><span>Ana Kim</span><span class="split-item-meta">9:41</span></span>
<span class="split-item-subject">Order #10421: new address</span>
<span class="split-item-text">Hi! Could you send my order to my office instead? The address is Rua das Flores 12, Lisbon.</span>
</span>
<template>
<div class="person mb-4"><span class="avatar bg-pink">AK</span><span class="person-text"><span class="person-name">Ana Kim</span><span class="person-sub">9:41</span></span></div>
<p>Hi! Could you send my order to my office instead? The address is Rua das Flores 12, Lisbon.</p>
<p>Thanks, Ana</p>
<button class="btn btn-brand btn-sm" type="button"><i class="mi mi-reply"></i> Reply</button>
</template>
</a>
<a class="split-item is-unread" href="#m2" data-id="m2" data-title="Loved the linen tote">
<span class="avatar avatar-sm bg-cyan">MR</span>
<span class="split-item-body">
<span class="split-item-title"><span>Marco Rossi</span><span class="split-item-meta">8:15</span></span>
<span class="split-item-subject">Loved the linen tote</span>
<span class="split-item-text">Just wanted to say thank you: the tote arrived yesterday and it is perfect. Will order again!</span>
</span>
<template>
<div class="person mb-4"><span class="avatar bg-cyan">MR</span><span class="person-text"><span class="person-name">Marco Rossi</span><span class="person-sub">8:15</span></span></div>
<p>Just wanted to say thank you: the tote arrived yesterday and it is perfect. Will order again!</p>
<button class="btn btn-brand btn-sm" type="button"><i class="mi mi-reply"></i> Reply</button>
</template>
</a>
<a class="split-item" href="#m3" data-id="m3" data-title="Refund for #10419">
<span class="avatar avatar-sm bg-yellow">LF</span>
<span class="split-item-body">
<span class="split-item-title"><span>Lena Fischer</span><span class="split-item-meta">Yesterday</span></span>
<span class="split-item-subject">Refund for #10419</span>
<span class="split-item-text">The shirt was too small, so I sent it back on Monday. When will the refund arrive?</span>
</span>
<template>
<div class="person mb-4"><span class="avatar bg-yellow">LF</span><span class="person-text"><span class="person-name">Lena Fischer</span><span class="person-sub">Yesterday</span></span></div>
<p>The shirt was too small, so I sent it back on Monday. When will the refund arrive?</p>
<button class="btn btn-brand btn-sm" type="button"><i class="mi mi-reply"></i> Reply</button>
</template>
</a>
<a class="split-item" href="#m4" data-id="m4" data-title="Wholesale prices">
<span class="avatar avatar-sm bg-lime">SO</span>
<span class="split-item-body">
<span class="split-item-title"><span>Sam Okafor</span><span class="split-item-meta">Mon</span></span>
<span class="split-item-subject">Wholesale prices</span>
<span class="split-item-text">We run a small shop in Lagos and would like to stock your bags. Do you offer wholesale prices?</span>
</span>
<template>
<div class="person mb-4"><span class="avatar bg-lime">SO</span><span class="person-text"><span class="person-name">Sam Okafor</span><span class="person-sub">Monday</span></span></div>
<p>We run a small shop in Lagos and would like to stock your bags. Do you offer wholesale prices?</p>
<button class="btn btn-brand btn-sm" type="button"><i class="mi mi-reply"></i> Reply</button>
</template>
</a>
<a class="split-item" href="#m5" data-id="m5" data-title="Stock update">
<span class="avatar avatar-sm bg-violet">PN</span>
<span class="split-item-body">
<span class="split-item-title"><span>Priya Nair</span><span class="split-item-meta">Nov 20</span></span>
<span class="split-item-subject">Stock update</span>
<span class="split-item-text">The new canvas bags arrived at the warehouse: 120 in total. I have updated the stock.</span>
</span>
<template>
<div class="person mb-4"><span class="avatar bg-violet">PN</span><span class="person-text"><span class="person-name">Priya Nair</span><span class="person-sub">Nov 20</span></span></div>
<p>The new canvas bags arrived at the warehouse: 120 in total. I have updated the stock.</p>
</template>
</a>
</div>
<div class="split-detail">
<header class="split-header">
<button class="split-back" type="button" aria-label="Back to messages"></button>
<h2 class="split-title">Message</h2>
</header>
<div class="split-body"></div>
<div class="split-empty"><i class="mi mi-mail"></i> Choose a message to read it</div>
</div>
</div>The split follows its own width, not the screen's: in a narrow panel it stacks even on a big monitor. Change where with data-split-at="900" (pixels, 640 by default). Give it a height: in an app shell it fills the content area by itself (100%); anywhere else set --split-height. data-persist="name" remembers the divider's place in the browser.
On phones
Tap a message: the details slide in over the list, with a back button. Back (the button, Esc, or the phone's Back) slides them away and puts you on the message you came from. This one is narrow, so it is stacked on any screen:
Contact
<div class="split w-80" data-momo-split style="--split-height: 24rem" id="split-phone">
<div class="split-list" aria-label="Contacts">
<button class="split-item" type="button" data-id="c1" data-title="Ana Kim">
<span class="avatar avatar-sm bg-pink">AK</span>
<span class="split-item-body"><span class="split-item-title"><span>Ana Kim</span></span><span class="split-item-text">Designer, Toronto</span></span>
<template><p><b>Email</b><br>ana@momo.test</p><p><b>Phone</b><br>+1 416 555 0142</p></template>
</button>
<button class="split-item" type="button" data-id="c2" data-title="Max Ruiz">
<span class="avatar avatar-sm bg-cyan">MR</span>
<span class="split-item-body"><span class="split-item-title"><span>Max Ruiz</span></span><span class="split-item-text">Support, Madrid</span></span>
<template><p><b>Email</b><br>max@momo.test</p><p><b>Phone</b><br>+34 91 555 0199</p></template>
</button>
<button class="split-item" type="button" data-id="c3" data-title="Lea Novak">
<span class="avatar avatar-sm bg-lime">LN</span>
<span class="split-item-body"><span class="split-item-title"><span>Lea Novak</span></span><span class="split-item-text">Engineer, Ljubljana</span></span>
<template><p><b>Email</b><br>lea@momo.test</p><p><b>Phone</b><br>+386 1 555 0107</p></template>
</button>
</div>
<div class="split-detail">
<header class="split-header"><button class="split-back" type="button" aria-label="Back to contacts"></button><h2 class="split-title">Contact</h2></header>
<div class="split-body"></div>
</div>
</div>Filling the details
Two ways. Listen to momo:select and load the item (most apps), or keep each item's details in a <template> inside it, with data-title for the header: Momo puts them in .split-body and .split-title for you (the demos above do this).
inbox.addEventListener('momo:select', async (e) => {
const body = inbox.querySelector('.split-body');
body.innerHTML = await loadMessage(e.detail.id); // e.preventDefault() refuses the choice
});
const split = Momo.split('#inbox');
split.open('m3'); // by data-id, or pass the item
split.back(); // stacked: back to the list
split.selected; // the chosen item
split.stacked; // true when it shows one side at a timeKeyboard
- ↑ ↓ Home End move through the list, Enter opens. With
data-split-followthe details follow as you move (side by side only). - The divider takes ← → (Shift for bigger steps); Enter or a double click resets it.
- When stacked, opening moves the focus to the details' title, and Esc goes back to the item you came from.
Reference
| Class / attribute | What it does |
|---|---|
.split[data-momo-split] | The split; side by side from 640px of its own width, stacked below. .split-flush drops its frame |
data-split-at, data-persist, data-split-follow | Where it stacks, remember the divider, open as you arrow through |
.split-list, .split-list-header | The list (scrolls on its own), a sticky bar on top (search, filters) |
.split-item (a or button), .is-unread | A row; bold with a dot when unread; the chosen one gets aria-current |
.split-item-body, -title, -meta, -subject, -text | The row's parts: name and time, a one-line subject, a two-line preview |
.split-detail, .split-header, .split-back, .split-title, .split-body | The details: a header with the back button (shown when stacked) and title, then the content |
.split-empty | Shown in the details while nothing is chosen (side by side) |
--split-list, --split-height | The list's width (22rem; the divider sets it), the height (100%) |
| Events | momo:select (cancelable; { item, id }), momo:back |