Responsive layouts
A company directory can fill a desktop page or sit inside a narrow panel. Give the layout the space it has and keep the selected record in the URL.
One directory, two views
Open a company, then change the preview width. Below 33rem, the selected record gets the whole panel. At 33rem and up, the directory sits alongside it.
Stillwater
Furniture · Stockholm
- Project
- Showroom fixtures
- Account owner
- Maya Chen
- Team size
- 116 employees
Choosing a company puts focus on its name. In the narrow view, Company directory returns to its row. Browser Back opens the previous selection.
Use this pane layout
Load the two stylesheets below. Give each company its own GET route. Render data-open-record on .sc-panes when the URL selects a company. For HTMX requests, return the updated #companies element and focus the record heading after the swap.
Company directory HTML
<link rel="stylesheet" href="/mero.css">
<link rel="stylesheet" href="/studio-companies.css">
<section class="sc-companies" aria-label="Companies">
<div class="sc-panes" id="companies">
<nav class="sc-directory" aria-label="Company directory">
<a class="sc-account" href="/companies/forma"
hx-get="/companies/forma" hx-target="#companies"
hx-swap="outerHTML" hx-push-url="true">Forma Works</a>
</nav>
<article class="sc-record" aria-label="Company record">
<a class="sc-back sc-text-link" href="/companies">Company directory</a>
<h2 tabindex="-1">Forma Works</h2>
<p>Retail design · Copenhagen</p>
</article>
</div>
</section>Choose a layout by its contents
- Fields
- Use
rl-stackfor vertical spacing. Keep each field’s label, input and error together. - Actions
- Use
rl-rowfor a wrapping row. Choose Toolbar when the first and last groups need to sit on opposite edges. - Cards
- Use Item Card Group for equal columns. Each card gets at least 13rem where space allows. At smaller widths it fills the row.