Overview

stack({ direction, spacing, wrap, fill, … }) applies flex layout to a host element. Default direction is column.

Use it when you want the same API as the flex custom elements but without adding a wrapper node.

stack() on nav + aside

Horizontal nav and vertical sidebar — both via stack().

import { html, renderApp } from 'mates';
import { stack } from 'mates-ui';

const App = () => {
return () => html`
<div class="card card-body m-w-full">
<nav ${stack({ direction: 'row', spacing: 1.5 })}
class="card card-body m-b-10"
>
<a href="#">Home</a>
<a href="#">Docs</a>
<a href="#">About</a>
</nav>
<aside ${stack({ spacing: 1, p: '1rem' })}
class="card card-body"
>
<strong>Sidebar</strong>
<span class="muted">Item one</span>
<span class="muted">Item two</span>
</aside>
</div>
`;
};

renderApp(App, document.getElementById('app'));