Overview

Both directives take justifyContent, alignItems, and an optional props object. Apply with lit-html directive syntax: ${row(...)}.

They re-apply on every render, so reading an atom in the arguments makes layout reactive.

Reactive row ↔ col

Toggle between row() and col() on the same section.

import { html, atom, renderApp } from 'mates';
import { row, col } from 'mates-ui';

const App = () => {
const asRow = atom(true);

return () => html`
<div class="card card-body m-w-full">
<button
class="m-b-10"
@click=${() => asRow.set(v => !v)}
>
Toggle: ${asRow() ? 'row' : 'col'}
</button>
<section ${asRow()
? row('start', 'center', { gap: '0.75rem' })
: col('start', 'stretch', { gap: '0.5rem' })
}
class="card card-body"
>
<div class="card">A</div>
<div class="card">B</div>
<div class="card">C</div>
</section>
</div>
`;
};

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