Files
coulobre/docs/panel-design.md
T
parkel f596f092fb
Coulobre Panel CI / Checks (Python 3.12) (pull_request) Successful in 1m47s
Coulobre Panel CI / Checks (Python 3.14) (pull_request) Successful in 1m59s
Align panel checkboxes and radio choices with their labels
2026-12-03 23:51:47 +01:00

4.6 KiB

Panel design guidelines

Core and Premium share one panel interface. Core owns the workspace layout, theme tokens, and reusable UI patterns. Both editions follow this guide. Reuse Core's templates and classes before adding a new style. If a pattern belongs in both editions, add it to Core and document it here. Premium should only use shared components available in its supported Core versions.

Page structure

  • Extend the workspace template for signed-in pages. Follow HTTP Settings for pages with tabs. Put the page title and any page-wide actions first, then local tabs, then an account or domain selector if needed. The workspace divider separates these controls from the content.
  • Keep the page title stable across tabs. Mark the current tab with aria-current="page" and give the tab navigation an accessible label.
  • Use .live-sections to space stacked sections. Keep live status refreshes separate from forms so they cannot erase edits or move keyboard focus.
  • Use .surface for sections, .section-heading for ordinary section headers, and .table-scroll around tables. Keep horizontal overflow in the table wrapper and give empty or pending states an explicit label.
  • Extensions may add their running software versions to About Coulobre through the optional panel_extension_versions template context. Pass pairs of plain-text labels and versions only after checking access to the extension. Core does not load or inspect extension packages.

Forms and actions

For a compact editor, use .surface.editor-surface on the card and .editor on the form. Render Django fields with form.as_div so each field, label, and validation message occupies one row in the shared grid. Put the explanation and submit action inside the same grid. Don't add a padded .section-heading inside an already padded editor card. The heading, help, fields, and actions should share a left edge.

<section class="surface editor-surface" aria-labelledby="example-heading">
    <form method="post" class="editor">
        {% csrf_token %}
        <header>
            <h2 id="example-heading">Edit settings</h2>
            <p class="muted">Explain what these settings affect.</p>
        </header>
        {{ form.as_div }}
        <div class="form-actions">
            <button type="submit" class="button primary">Save settings</button>
        </div>
    </form>
</section>
  • Use one clear primary action per form. Put secondary actions such as Cancel in the same .form-actions row when they apply to that form.
  • Use short, sentence-case action labels. Keep field errors beside their inputs. Use visible labels and keep essential instructions available without relying on pointer hover.
  • Prefer the shared compact type and spacing. Use the panel stylesheet and its theme tokens for type, color, spacing, and focus states. Avoid fixed control widths, inline styles, and page-specific font sizes.

Checkboxes and radio choices

Place the native control before its label, on the same row. The visible label should toggle the control, and a long label should wrap underneath its own text. Keep descriptions and errors below the label text. Preserve Django's label association, error state, and description IDs.

  • For Django-generated forms, use form.as_div. When rendering a single bound field, put field.as_field_group in its own wrapper. The shared stylesheet aligns the control and label without replacing the widget.
  • For a handwritten confirmation, wrap the input and text in one label. Keep radio choices and multi-checkbox groups in a fieldset with a visible legend naming the group.
  • Keep a compound control, such as a numeric quota with Unlimited, in its own editor row. Its checkbox still sits next to its own label.
  • Use the shared stylesheet in both Core and Premium. Check click and keyboard operation, wrapping, and focus in both themes at a narrow width.
<label><input type="checkbox" name="confirm" required> Confirm this change</label>

Review a UI change

Compare the result with a Core page that serves the same purpose. In light and dark mode, check desktop and narrow widths, keyboard focus, and fields with validation errors. Try long domains, identifiers, and filenames. Text should stay readable, controls should remain inside their cards, and wide tables should scroll within their wrapper. Verify empty and populated states for lists. For Premium changes, use the same checks against the supported Core layout before introducing a new pattern.