Разложите поля по разделам с заголовками второго уровня — голова
страницы уже держит заголовок первого:
HTML
<section aria-labelledby="address">
<h2 id="address">Адрес панели</h2>
<sf-input size="1" label="Адрес" default-value="panel.larena.cloud"></sf-input>
<sf-input size="1" label="Порт" default-value="9443" hint="Число от 1 до 65535"></sf-input>
</section>
Поставьте кнопку сохранения в конце формы. Как сообщать об ошибках полей
и ответа сервера — в рецепте
«Сохранение и ошибки»
SIMAI Framework.
Результат
Страница настроек
HTML
<script src="assets/admin-demo.js"></script>
<div class="page-screen">
<sf-admin-shell product="Larena Panel" width="read">
<sf-admin-menu slot="menu" aria-label="Меню" expected-columns="2" current="panel.general"></sf-admin-menu>
<sf-header-page slot="head" heading="Общие настройки"></sf-header-page>
<section class="page-section" aria-labelledby="address">
<h2 id="address" class="page-section-title">Адрес панели</h2>
<sf-input size="1" label="Адрес" default-value="panel.larena.cloud"></sf-input>
<sf-input size="1" label="Порт" default-value="9443" hint="Число от 1 до 65535"></sf-input>
</section>
<section class="page-section" aria-labelledby="signin">
<h2 id="signin" class="page-section-title">Вход</h2>
<sf-switch label="Двухфакторный код для всех администраторов" checked></sf-switch>
<sf-switch label="Предупреждать за 2 минуты до конца сессии"></sf-switch>
</section>
<div class="page-save"><sf-button text="Сохранить"></sf-button></div>
</sf-admin-shell>
</div>
CSS
/* An example frame takes the height of its content, so a part as tall as the
window (100dvh) would make it grow without end. In this box the box is the
window: the frame is as tall as the box, the menu column too. On a page of
your own none of this is needed. */
.page-screen { block-size: var(--sf-g6); overflow: auto; }
.page-screen sf-admin-shell .sf-admin-shell { min-block-size: 100%; }
.page-screen sf-admin-shell .sf-admin-shell__nav { block-size: calc(var(--sf-g6) - var(--sf-admin-shell-stick, 0px)); }
.page-section { display: flex; flex-direction: column; gap: var(--sf-space-1); margin-block-end: var(--sf-space-2); }
.page-section-title { margin: 0; font-size: var(--sf-text-size-1); line-height: var(--sf-text-height-1); font-weight: var(--sf-font-weight-medium); }
.page-save { display: flex; gap: var(--sf-space-1); }
JavaScript
// A settings page: the frame at the reading width (width="read").
AdminDemo.serve(AdminDemo.host({current: 'panel.general'}));