Settings
Manage your workspace preferences.
Initial server-rendered HTML
<div class="rl-app">
<aside class="rl-app-nav">
<span class="rl-app-brand"><span aria-hidden="true" class="rl-app-monogram">S</span>Studio</span>
<nav aria-label="Workspace">
<a href="/layouts/dashboard">Overview</a><a href="/layouts/dashboard?view=inventory">Inventory</a><a href="/layouts/settings" aria-current="page">Settings</a>
</nav>
</aside>
<section class="rl-app-main" aria-label="Workspace content">
<header class="rl-page-head"><div><h1>Settings</h1><p>Manage your workspace preferences.</p></div></header>
<form class="rl-settings" id="layout-settings" data-rl-return-focus="#settings-save" data-rl-form hx-post="/demo/settings" hx-target="this" hx-swap="outerHTML">
<section aria-labelledby="workspace-details">
<h2 id="workspace-details">General</h2>
<p>Choose the name your team sees in the workspace.</p>
<div class="rl-field">
<label class="rl-label" for="workspace-name">Workspace name</label>
<input class="rl-input" id="workspace-name" name="name" required maxlength="48" value="Studio">
</div>
</section>
<section aria-labelledby="workspace-notifications">
<h2 id="workspace-notifications">Notifications</h2>
<label class="rl-row"><input type="checkbox" class="rl-switch" role="switch" name="digest" value="on" checked> Weekly inventory digest</label>
</section>
<p role="alert" data-rl-form-error hidden></p>
<div class="rl-settings-actions"><button class="rl-button rl-button-primary" id="settings-save" type="submit">Save settings</button></div>
</form>
</section>
</div>HTTP exchange
Use the preview to see the request and the HTML your server returns.Use in your app
POST /demo/settings returns the saved form. On a validation error it returns the submitted values and field errors with HTTP 422. On success the HX-Trigger-After-Settle header announces the save.
Serve these assets from the download’s public/ directory. Add the tags to your page head.
Page assets
<link rel="stylesheet" href="/mero.css">
<link rel="stylesheet" href="/mero-layouts.css">
<script defer src="/vendor/htmx.min.js"></script>
<script defer src="/mero.js"></script>
<script defer src="/mero-forms.js"></script>Server source · server.mjs
Download full example source ↓