UI Style Guide - edmozley/freeitsm GitHub Wiki

UI style guide

Status: first draft, from discussion #185. The action row is live in Tickets, Assets and Software, so it can be tried before every other module follows. Comments on the discussion are welcome. Once it has settled, the rest of the modules move over one family at a time (section 7).

The rules every analyst-facing screen in FreeITSM follows, so a screen behaves the same whichever module you are in. They sit alongside the Help page house style, Theming and dark mode and the mobile techniques.

The principle behind all of them: predictable beats clever. Somebody moving between twenty-odd modules should find the same thing in the same place, called the same word.


1. Buttons

  • One word, unless a second word is strictly necessary. Save, Delete, Cancel, New, Export, Scan - not Save changes, Add application or Export CSV.
  • Sentence case when there is more than one word: Delete forever, never Delete Forever.
  • No "+" and no icon on a text button. New, not + New. Icon-only buttons (search, filter, refresh in a list header) are fine, and they carry a tooltip.
  • The tooltip says what the one word does to what - New ticket, New asset. That is what a screen reader reads, so the short label loses nothing.

When two words are allowed:

Case Example Why
Two buttons with the same verb side by side New channel / New message One word would make them identical
A second, stronger version of an action Delete beside Delete forever The difference is the point
A label that names a place or a thing that changes Go to TICKET-123, Move to Junk The second word is the information
Right-click menu items Copy asset tag, Print label A menu is read, not scanned, and has room
An empty page's invitation Create your first article It is a sentence, not a button row

Classes: the shared .btn with .btn-primary or .btn-secondary (assets/css/inbox.css), or .action-row-btn in the action row. โš ๏ธ .btn-primary on its own sets only colour - always pair it with .btn. A module defining its own button family is a bug waiting to be found, and several still do (section 7).


2. Creating a record: the action row

Where: a strip directly under the module header, the full width of the page. What this page is on the left; what you can do here on the right, with New at the far right.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ โ‹ฎโ‹ฎ Assets  [Assets][Table][Users][Dashboard]โ€ฆ        [Defaultโ–พ] ๐Ÿ”” A โ”‚  module header
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Assets - 633 found                                            [New] โ”‚  action row
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ [search....] โ”‚                                                       โ”‚
  • New is one word, in the module's own colour (--accent), and its tooltip names the thing.
  • Every view of the same records gets the same row - list, table, board, calendar - so New is never missing just because you switched views. Where the form lives on another page, New links there (Assets' table view opens ./?new=1).
  • Outside every pane and panel. On a phone it stays on screen, never inside a Filters or Tags sheet.
  • A page with nothing to create has no New button, never a dead one. The row can still carry the title.
  • Shortcuts may stay where they are useful. A + at the top of a board column, which creates a task already in that status, is a shortcut beside New, not instead of it.
  • Things that are not "creating a record" keep their own words and places - Upload, Scan, Plan, Assign.

Building it: never by hand. Straight after the header include:

<?php include 'includes/header.php'; ?>
<?php require_once '../includes/action_row.php';
      renderActionRow(t('tickets.nav.inbox'), [
          actionRowNew('openNewTicketModal()', t('tickets.list.new_ticket_btn')),
      ]); ?>
Option Use
title_id The page rewrites the title - Assets' Assets - 633 found
count_id A count after the title, which the page fills; the dash appears only once it is filled
extra Trusted HTML before the buttons - Software's search box
actionRowNew($js, $tooltip, true) New is a link, not a script call
'accent' => 'cm' The row takes a module's colour from theme.css (--cm-accent and friends) on a page that does not set --accent itself
'hidden' => true on a button It starts hidden and the page shows it - LMS shows each tab's buttons as you switch tabs
'disabled' => true on a button It starts disabled and the page enables it - CMDB's New waits for a class
class="action-row-search" on an extra input A search box styled for the row, for a page without its own .search-box

Other buttons (Domains' Paste list, Import CSV) go before New, unfilled. On a phone they share a line of their own under the title, so New stays beside it.

The row brings its own stylesheet (assets/css/action-row.css, through BASE_URL), so no page needs a new <link>. It also makes the page's .main-container (or .dt-page) take whatever height is left, so a page needs no calc(100vh - N) of its own.


3. Full width

  • Pages use the whole width of the screen. No max-width on a page's container, no centred column.
  • โš ๏ธ max-width: none is not enough inside a flex parent: an inherited margin: auto still shrinks and centres it. Use width: 100%; max-width: none; margin: 0.
  • Caps on single things are fine - a text input, a modal, a reading column inside a document viewer - because a form field stretched across 3000px helps nobody.
  • Check by measuring, never by reading the CSS: the container's getBoundingClientRect().width against the window.
  • System pages share one layout (since 5.3.0): assets/css/system-page.css, loaded by the System header, and a browser test that measures every System page. See System page layout.

4. Colour and theme

  • Theme tokens only - var(--surface), var(--text), var(--border), var(--accent) - never a hard-coded colour, so dark mode works. See Theming and dark mode.
  • Each module's accent is its colour in System โ†’ Module colours, through --accent - the primary button, links, the active tab and the selected row take it. Since the release after 5.4.1 this is done once for every module by renderWaffleMenuPanel() (includes/module_accent.php, GH #302); a page never sets --accent itself. At a default colour a module with its own set in theme.css (--cal-accent, --kb-accent ...) keeps those hand-tuned light and dark shades; a colour an administrator changed drives --accent and that set, kept readable at 4.5:1 (a pale yellow is deepened, a dark navy lifted in dark mode).
  • Status colours are not the accent. Red for overdue, green for done, amber for warnings mean something and stay as they are in every module.
  • No new hard-coded colours. tests/css-colour-guard.php (CI, Web exposure job) counts colours in assets/css outside a var() fallback against tests/baselines/css-colours.json: a file may go down, never up, and a new stylesheet starts at zero. After converting, run it with --update to lock the lower number in.

4a. Design tokens beyond colour

From discussion #363 (@cloudcogsio). The same idea as the colour tokens: each token is today's most common value, so moving a rule onto one changes nothing, and every use carries the old value as its fallback - var(--radius-md, 6px) - so a page without theme.css is unchanged too. They live once in the plain :root block at the top of assets/css/theme.css, because they are the same in every palette.

Kind Tokens Values
Font --font, --font-mono 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif ยท ui-monospace, Consolas, monospace
Size --font-size-xs โ€ฆ --font-size-4xl 11 ยท 12 ยท 13 (normal text) ยท 14 ยท 16 ยท 18 ยท 20 ยท 24 px
Weight --font-weight-normal / -medium / -bold 400 ยท 500 ยท 600
Space --space-1 โ€ฆ --space-6, --space-8 a 4px scale: 4 ยท 8 ยท 12 ยท 16 ยท 20 ยท 24 ยท 32 px
Corners --radius-sm / -md / -lg / -xl / -pill 4 ยท 6 ยท 8 ยท 10 ยท 999 px
Elevation --shadow-1 / -2 / -3 a card ยท a popup or menu ยท a dialog

Use one of these instead of a new value. If none fits, raise it here rather than adding a one-off. The long tail of today's sizes (57 font sizes, 12.5px, 11.5px ...) moves to the nearest token as each module is converted - a half-pixel change. 15px is the one to watch: it becomes 14 or 16, which can be seen, so it is decided per module with a before-and-after.

Decided (16 November 2026, Ed, on discussion #363)

  • Standardise, don't restyle. The goal is one consistent app and less hard-coded styling - not a new look. "A lot of what looks good comes down to personal preference."
  • No branded "Modern" look for now (the neutral header, logo in the header, brand colour and new font in #363 part 4). It may be revisited later; the tokens make it possible without touching modules.
  • A module's buttons, tabs and highlights take the module's own colour - #363's option A, which is GH #302. Built: see section 4.
  • About eight font sizes, not five: five would push headings and dashboard figures off the scale.
  • Who builds what: the tokens, the colour guard and the accent are built in-house (the release after 5.4.1). Converting modules - one module per PR, with before-and-after screenshots that should look the same - is open to contributors.

Font sizes: done in one pass (20 November 2026)

Ed asked for the font sizes to be tokenised across every module at once rather than module by module. scripts/tokenise_font_sizes.php swapped 4,994 sizes in 305 files - stylesheets, <style> blocks, inline style="" and the HTML that scripts build - wherever the size was already on the scale: font-size: 13px became font-size: var(--font-size-md, 13px). Because each token equals the size it replaced and keeps it as the fallback, nothing on screen moved: 34 pages screenshotted before and after on the test install were pixel-identical, apart from clocks and a chart's animation.

What was left after that first pass - about 990 sizes between the steps (238 ร— 12.5px, 232 ร— 15px, 108 ร— 11.5px, 100 ร— 10px, 85 ร— 22px, 57 ร— 13.5px ... and a few display sizes from 26px up). Moving those changes what people see, so they move only in a deliberate pass with before-and-after screenshots (see Converting a module). Sizes above 24px are headline and dashboard figures and may stay as they are.

Then the in-between sizes - rounded UP (Ed, 20 November 2026). The same day Ed decided the rest go up to the next step: 8-10.5px โ†’ 11, 11.5 โ†’ 12, 12.5 โ†’ 13, 13.5 โ†’ 14, 14.5-15.5 โ†’ 16, 17 โ†’ 18, 19 โ†’ 20, 21-22 โ†’ 24 (php scripts/tokenise_font_sizes.php --round-up --apply). 869 sizes in 191 files; the change is slight (most were half a pixel) and the before-and-after screenshots showed nothing overflowing or wrapping that did not before. What is left: 121 sizes of 25px and over - headline and dashboard figures, above the top step, with no token.

One change moves the lot. Because every size is now a token, changing one value in theme.css - say --font-size-md from 13px to 12px - changes every piece of text at that step in every module. It cannot pick out one module (that would be a local override), and a step changed to equal its neighbour merges the two, so adjust the scale as a whole. Emails, the editor iframe and the iOS 16px do not follow (below).

Never tokenised - emails. Email clients (Outlook above all) do not understand var() and drop the whole declaration, so an email would lose its sizes. Every file that builds an email body, or HTML that is stored and later emailed, is out of scope and keeps literal sizes; so is TinyMCE's content_style (it styles the editor's iframe) and the 16px that stops iOS zooming into a field (GH #1388). The list is in tests/support/font_size_scope.php, shared by the converter and the guard. A new file that builds an email belongs on it.

The guard. tests/font-size-guard.php (CI, Web exposure job, beside the colour guard) counts literal sizes per file against tests/baselines/font-sizes.json: a file may not go up, and a new file starts at zero - use a token. After a conversion lowers a count, run it with --update.

Type on a settings page (decided 20 November 2026, Ed)

"Things that are headings should be a heading size." The first attempt made the headings bigger and still did not feel right. The real trouble was the body: nothing set its size, so paragraphs, table cells and table headers fell back to the browser's 16px - bigger than the labels, dropdowns and buttons (14px) and the help text (12px) - and any heading had to shout over it. Sub-headings meanwhile came in six sizes (13px .tc-sub / .tt-sub, 14, 15, 18 and the unstyled 18.72px). The fix brings the body down and keeps the headings modest:

Role Element Size Token
Section title .section-header h2 24px --font-size-4xl
Sub-section h3 (.ts-sub, .tc-sub, .tt-sub) 18px, 600 --font-size-2xl
Group h4 (.tc-sub4) 16px, 600, normal case --font-size-xl
Body - paragraphs, table cells, inputs, dropdowns, labels, toggle names .tab-content and form controls 14px --font-size-lg
Table header th 13px, 600, muted --font-size-md
Help - hints, notes, descriptions, small 13px --font-size-md
A count beside a value ("1 in use") .tc-count 12px, in a pill --font-size-sm
  • A line marks a new sub-section: every sub-section after the first among its neighbours starts with a thin rule and space above it, so a 16px group heading reads as sitting under the 18px sub-section rather than beside it. A box that already has its own border (an SLA card, a Checklists section) gets no second line.
  • No line-length cap. Shorter lines read better in theory, but on a wide settings page a narrow column of text beside full-width tables broke mid-sentence - tried and taken out the same day.
  • Set once, in the page's style block under .tab-content, so no tab chooses its own; a heading or paragraph never carries an inline font-size, and the level is chosen by the element (h3 / h4).
  • Tickets โ†’ Settings first, measured on all 21 tabs. The other modules' settings pages follow the same scale.

Decided with Ed, prompted by a second opinion he asked for (it spotted that the table text was outsizing the headings, which was right; its pixel estimates read 15-25% high because of display scaling in the screenshots).

Converting a module

  1. Swap hard-coded colours for tokens with the old value as the fallback: #ef6c00 โ†’ var(--cal-accent, #ef6c00). Light mode stays pixel-identical.
  2. Swap corners and shadows for the tokens above, same rule. (Font sizes on the scale are already done - see above; what remains is moving the in-between sizes onto it.)
  3. Take before-and-after screenshots in light and dark of the module's main pages; anything that changed must be explained in the PR.
  4. Run php tests/css-colour-guard.php --update (and php tests/font-size-guard.php --update if sizes moved) and commit the lower baseline with the change.

Calendar was the first, with GH #302: its 11 hard-coded oranges became --cal-accent tokens (21 โ†’ 10 in the guard's count).


5. Words

  • Sentence case for every heading, tab, label and button: Software inventory, Recycle bin.
  • Plain hyphens in text, and one name for one thing across modules.
  • Every string goes through t(). A new shared word belongs in lang/en/common.php.

6. Phones

Everything phone-specific lives inside @media (max-width: 768px), so the desktop never changes because of a phone fix. See Mobile-friendly techniques and the module's own mobile page before changing anything. A shared component may carry its own phone rules in its own stylesheet, gated the same way (action-row.css does).


7. Rollout

First: Tickets, Assets and Software (the three named in #185). Then, once the discussion is happy with them, one family at a time:

Family Modules Where New is today
โœ… Done Tickets, Assets (incl. Table), Software The action row
โœ… Registers CMDB, Domains (incl. Table), Contracts The action row (3.13.0)
โœ… Service work Changes (incl. Calendar, Table), Problems, Tasks (Board, List, Calendar, Timeline, Table) The action row (3.13.0); Tasks' column + stays as a shortcut
โœ… Content Knowledge, Checklists, Process mapper, Forms, LMS, Workflow, Network mapper The action row (3.13.0); LMS's buttons follow its tab
โœ… Other Calendar (incl. Table), Projects, Service status, War room The action row (3.13.0); Service status keeps Plan, War room keeps New message
No create People, Morning checks, Reporting, Watchtower, System No row - the header already says where you are, and a row with nothing to do is just height

Also found by the audit, to fix as each module moves:

  • About 70 buttons with more than one word on main pages - Create Ticket, Export CSV, Paste list, Back to list, Full screen - and eight in Title Case.
  • About 15 different button classes for the one create action, and module-local .btn families in Assets, CMDB, Service status, Calendar and LMS.
  • "+" written three ways - in the translation, added in PHP, or as an icon - and none at all elsewhere.
  • Reporting's landing page is the one main page still capped (1160px).

Related pages

โš ๏ธ **GitHub.com Fallback** โš ๏ธ