{% extends "htmx/base.html" %} {% block main %}

Style guide

Headings

All pages except the incident list (at /incidents/) should start with a <h1> heading.

h1
<h1 class="text-center text-3xl font-semibold mt-3">
h2
<h2 class="text-2xl">
h3
<h3 class="text-xl">

The template htmx/components/_page_title.html will wrap a {% verbatim %} {{ page_title }} {% endverbatim %} or {% verbatim %} {{ title }} {% endverbatim %} in context in the correctly styled <h1>.

The card component is an exception to heading sizes. Its font size is always set by the .card-title class to match .text-xl. However, use the correct heading level inside the card title for semantic accuracy. E.g. using <h2> inside a card that is a subsection of the page.

Buttons

Primary color

{% verbatim %} <input type="button" class="btn btn-primary".. {% endverbatim %}
{% verbatim %} <input type="button" class="btn btn-primary".. {% endverbatim %}
<a> button
{% verbatim %} <input type="button" class="btn btn-primary".. {% endverbatim %}

Secondary color

{% verbatim %} <input type="button" class="btn btn-secondary".. {% endverbatim %}
{% verbatim %} <button class="btn btn-secondary".. {% endverbatim %}
<a> button
{% verbatim %} <a class="btn btn-secondary".. {% endverbatim %}

No extras

{% verbatim %} <input type="button" class="btn".. {% endverbatim %}
{% verbatim %} <button class="btn".. {% endverbatim %}
<a> button
{% verbatim %} <a class="btn".. {% endverbatim %}

We do not use other button types than these.

Form fields

Default rendering

The form below is for testing the look and feel of autogenerated forms, made via the {% verbatim %} {{ form }} {% endverbatim %} Django template syntax. Submitting will re-render the form with the submitted values pre-filled. Click "Reset" to empty the fields.

{% if request.GET %}

The form has been submitted.

{% if form.is_valid %}

The form is VALID!

Cleaned data: {{ form.cleaned_data }}
Non field errors: {{ form.non_field_errors }}
{% else %}

The form is NOT VALID!

Cleaned data: {{ form.cleaned_data }}
Non field errors: {{ form.non_field_errors }}
{% endif %} {% else %}

The form has not been submitted yet.

{% endif %}

This particular form is using tailwind grid classes to lay out the fields.

{{ form }}
Reset

A single field can be auto-generated via the {% verbatim %} {{ form.FIELDNAME.as_field_group }} {% endverbatim %} Django template syntax. Below is the field named "Input" from the form above:

{{ form.input_.as_field_group }}

You get just the actual input part of the field via the {% verbatim %} {{ form.FIELDNAME }} {% endverbatim %} Django template syntax. Below is just the actual input-part of the field named "Input" from the form above:

{{ form.input_ }}

Colors

These are the available color names and colors as set by the current selected theme.

{% comment %}Also useful for making sure tailwind finds all used colors.{% endcomment %}
base-100
base-200
base-300
primary
secondary
accent
neutral
info
success
warning
error
{% endblock main %}