# Look and feel

> Where the look of a module comes from, how to use the UI kit, how to give a custom view a design of its own, and the checks every custom screen should pass.

Some screens of a module look like nexxus by themselves, and some look however you draw them. This page says which is which, how a custom view follows the theme and the tenant's brand colour, how to give it a design of its own, and what to check before you call a screen done.

## Where the look comes from

| Screen | Who draws it | What the package decides |
|---|---|---|
| Lists, record pages, maps, the menu | nexxus | Fields, columns, filters, labels, icons, actions. Not colours, fonts or layout |
| Custom views in nexxus: `page`, `record.detail`, `record.tab`, `record.action`, `dashboard.widget` | Your HTML. nexxus draws the title above pages and record views, the title bar of a tile and the header of a dialog | Everything inside the frame |
| The public website | The portal app. Logo and brand colour come from the tenant's branding | Which records, fields, page types and sections it shows |
| A form by link (`public.form`) | nexxus draws a bar with the firm's logo and name; your view sits below it in a card at most 880 px wide | The form |
| The customer area (`member`) | The portal draws the header with the firm's logo, the client, <Ui>Sign out</Ui> and the role's pages as tabs; your view fills the rest | The content. Always light |

So your own design lives in custom views. Everything else follows nexxus or the portal, on purpose: people switch between a package's screens and nexxus's own many times a day, and a firm's clients should see the firm, not a different look per package.

## The theme reaches your view

The frame is transparent. Before your first script runs, nexxus puts the UI kit into the view: CSS variables (`--nx-*`) with the colours, radius, shadow and font of nexxus, and classes for buttons, cards, fields, lists and more. Once connected, the SDK sets the variables to the current values of nexxus, the tenant's brand colour included, and sets `<html data-theme="light">` or `"dark"`. When a person switches between light and dark mode, the SDK changes both at once and your view follows without reloading.

Use the variables instead of fixed colours, and your view is right in both modes and in every tenant's colour:

```css
.due { color: var(--nx-danger); }
.panel { background: var(--nx-surface); border: 1px solid var(--nx-line); border-radius: var(--nx-radius); }
```

### Colour and shape tokens

| Variable | Use |
|---|---|
| `--nx-text`, `--nx-text-muted` | Text; secondary text, labels, hints and table heads. Both at least 4.5:1 on every surface of the kit |
| `--nx-text-faint` | Placeholders, the dash in an empty cell, empty-state icons. Below 4.5:1: never for text a person has to read |
| `--nx-surface`, `--nx-surface-raised`, `--nx-surface-sunken`, `--nx-page` | Cards, menus, recessed areas, the page ground |
| `--nx-line`, `--nx-line-soft` | Borders and dividers |
| `--nx-brand`, `--nx-brand-contrast`, `--nx-brand-ink` | Brand fill, text on it, brand colour as text |
| `--nx-accent`, `--nx-success`, `--nx-warning`, `--nx-danger`, `--nx-info` | Signal colours |
| `--nx-series-1` to `--nx-series-6` | Chart series, light and dark |
| `--nx-radius`, `--nx-radius-sm`, `--nx-shadow`, `--nx-focus`, `--nx-gap` | Shape, focus ring, spacing |
| `--nx-font`, `--nx-font-mono` | Type |

### Classes

| Class | For |
|---|---|
| `nx-btn` with `nx-btn--primary`, `--danger`, `--quiet`, `--sm`, `--icon` | Buttons |
| `nx-badge` with `nx-badge--success`, `--warning`, `--danger`, `--info`, `--brand` | Status labels |
| `nx-card`, `nx-card__title` | A panel |
| `nx-field`, `nx-field__label`, `nx-field__hint`, `nx-field__error`, `nx-input`, `nx-select`, `nx-textarea` | Forms; `aria-invalid="true"` marks an error |
| `nx-list`, `nx-list__item` (`is-active`) | Lists; a `<button class="nx-list__item">` is clickable |
| `nx-rows`, `nx-entity-row` (`is-active`), `nx-meta` | Records the way nexxus draws its lists (markup below) |
| `nx-table` | Tables |
| `nx-empty`, `nx-empty__icon`, `nx-empty__title` | Empty states |
| `nx-title`, `nx-subtitle`, `nx-label`, `nx-muted`, `nx-faint`, `nx-mono`, `nx-num` | Type |
| `nx-stack`, `nx-row`, `nx-spacer`, `nx-divider` | Layout helpers |
| `nx-kbd`, `nx-progress` (`--nx-value`), `nx-spinner` | Small things |
| `nx-pdf-slot` | The region reserved for a PDF |

A list of records looks like the lists of nexxus with this markup. Every part is optional, and empty ones take no space. Only the status has colour; other facts are text in `nx-meta`. `nx-list-compact` on the list turns the cards into rows in one frame, `nx-list-hide-ids` hides the IDs, and `--nx-tile` colours the tile.

```html
<div class="nx-rows nx-list-compact">
  <button class="nx-entity-row" type="button">
    <span class="nx-entity-row__tile"><svg><!-- icon --></svg></span>
    <span class="nx-entity-row__main">
      <span class="nx-entity-row__title"><span class="nx-entity-row__heading">Vollmacht</span><span class="nx-entity-row__id">ID: 147</span></span>
      <span class="nx-entity-row__meta"><span class="nx-entity-row__sub">2026/0184</span><span class="nx-entity-row__person">Zuständig: Anna Berger</span></span>
    </span>
    <span class="nx-entity-row__right">
      <span class="nx-entity-row__tags"><span class="nx-badge nx-entity-row__status">Angefordert</span></span>
      <span class="nx-entity-row__dates"><span class="nx-meta">Geändert: 15.10.2026</span></span>
    </span>
  </button>
</div>
```

A row with buttons of its own is a `div.nx-entity-row` with them in `nx-entity-row__actions`, because a button inside a button is not valid HTML. `nx-entity-row__value` holds an amount.

`nx-select` draws its arrow as a background image. Give a select a `background-color`, not the `background` shorthand, or the arrow is gone.

## A design of your own

You can ignore the kit, change parts of it or replace it. Three levels, from the least to the most work:

1. **Like nexxus.** The kit's classes and tokens, nothing else. The right choice for most screens that staff use every day.
2. **nexxus with your touches.** Your stylesheet comes after the kit, so your rules for `.nx-card` or `.nx-btn` win where they are as specific. Keep using the tokens in your rules, so dark mode and the tenant's colour keep working.
3. **Your own design.** Your own palette, type and components, for a cockpit with a character of its own, a form for clients, or the pages of a customer area.

### Change the tokens on `body`, not on `:root`

The SDK writes the values of nexxus onto `<html>` as inline style, at the start and on every switch between light and dark. Inline style beats every stylesheet, so this has no effect:

```css
:root { --nx-brand: #0b3d5c; }   /* overwritten by the SDK */
```

Set your values one level lower. Custom properties inherit, so everything inside `body` uses yours. The font and the text colour are resolved on `<html>` already; set them again where you change their tokens:

```css
body {
  --nx-brand: #0b3d5c;
  --nx-brand-contrast: #ffffff;
  --nx-radius: 14px;
  --nx-font: "Brand Sans", system-ui, sans-serif;
  font-family: var(--nx-font);
  color: var(--nx-text);
}
html[data-theme="dark"] body {
  --nx-brand: #6fb3e0;
  --nx-brand-contrast: #0b1b26;
}
```

A design that is entirely your own reads more clearly with variables of its own (`--brand`, `--ink`), defined on `body` the same way. Derive them from the `--nx-*` tokens where the tenant's colour or the dark mode should still show through.

### Dark mode

Views in nexxus are shown in light and dark mode, whichever the person chose. A design of your own needs both: give every colour of yours a value under `html[data-theme="dark"]`, or derive it from the tokens. The customer area is always light, so its views need only the light palette.

### Fonts, icons and pictures

The frame loads nothing from the network, so everything comes along inside the HTML file (2 MB at most):

- **Fonts** as `@font-face` with a `data:` URL, ideally WOFF2 and only the weights you use. Without your own, `--nx-font` falls back to the system font, which looks fine.
- **Icons** as inline SVG. The icon font of nexxus is not available in the frame. Draw them with `stroke="currentColor"` or `fill="currentColor"`, so they take the text colour in both modes.
- **Logos and illustrations** as inline SVG or `data:` URLs.
- **Photos from Files** with `nx.images.url(documentId, {width})`, where `width` is the size on screen in CSS pixels, so a thumbnail does not load the full photo.

## Charts, tables and pickers

You do not have to draw charts by hand. The SDK draws them in the kit's style, in both modes, and redraws them when the space changes:

```js
nx.chart(document.getElementById('revenue'), {
  type: 'bar', labels: ['Jan', 'Feb', 'Mar'],
  format: {style: 'currency', currency: 'EUR', maximumFractionDigits: 0},
  series: [
    {name: 'Revenue', values: [32000, 41000, 38500]},
    {name: 'Last year', type: 'line', style: 'dashed', values: [30000, 35000, 36000]},
  ],
  refs: [{value: 40000, label: 'Target', good: 'above'}],
});
nx.chart(document.getElementById('share'), {type: 'kpi', value: 54, unit: ' %', label: 'Billable', target: 75, good: 'above', previous: 58});
```

| Call | Draws |
|---|---|
| `nx.chart(element, spec)` | `bar` and `line` (also combined, up to six series, with target lines and forecasts), `doughnut` for shares of a whole, and `kpi` for one key figure with target, change and a small trend line. Pointing at the chart shows the values; screen readers get a table of the same numbers. Returns `{update(spec), destroy()}` |
| `nx.table(element, spec)` | A sortable table with a format per column (`number`, `currency`, `percent`, `date`, `datetime`, `relative`), status values as badges (`badge: {Offen: 'warning'}`), text coloured by threshold, a totals row (`footer`) and "show all" after `maxRows`. Every value goes in as text. Returns `{update(spec), destroy()}` |
| `nx.picker(element, {search, onChange, ...})` | A search field that picks one record; `search(q)` returns what `nx.lookup` answers. Arrow keys, Enter and Escape work, and the list of matches lies over the rest of the view |

Draw yourself only what is not a chart of values: a timeline, a heatmap, a board.

## Layout per slot

- **`page`** fills the area under the title. Do not repeat the title; start with what the page adds, such as a period, a count or filters.
- **`record.detail` and `record.tab`** stand directly on the record page, like the sections of the <Ui>Data</Ui> tab, without a card behind them. Put your content into `nx-card`s. Their height follows the content.
- **`dashboard.widget`** gets its card and title bar from nexxus; draw only the content. A tile is at most 520 px tall and scrolls beyond that, and on a phone every tile is one column wide.
- **`record.action`** is the body of a dialog whose header is nexxus's. Bring your own buttons and finish with `nx.dialog.close(result)`.
- **`public.form`** sits in a card at most 880 px wide. Show your own confirmation after the submit: the view stays on the page.
- **`member`** sits below the portal's header. Draw no header, tabs or sign-out of your own. Keep the content in a centred column of at most 1160 px, with side gutters of 16 px, 24 px from 744 px wide and 40 px from 1128 px wide, so it lines up with the header.
- A view is at most 20 000 px tall. Do not set `height: 100%` on `<html>` unless the view is a page.

## Before you call a screen done

- Light and dark mode both look right (except in the customer area, which is always light).
- It works at 390 px wide, the width of a phone, and on a wide screen.
- Loading, empty and error states are drawn. Show `error.message` when a call fails; the server's messages are written for people.
- Long names and texts wrap instead of widening the page.
- Everything clickable is a `<button>` or a link, reachable with the keyboard, with a visible focus (`--nx-focus`).
- What people typed goes in with `textContent`, never with `innerHTML`.
- Every label has German and English text through `nx.t({de, en})`, Polish too if the firm works in Polish.
- `nxm logs --details` shows no errors of the view.

## Next steps

<CardGrid>
  <LinkCard title="Views and the view SDK" href="/modules/views/" description="Slots, context, every SDK call and its errors." />
  <LinkCard title="Customer area" href="/modules/customer-area/" description="Pages for clients who sign in." />
  <LinkCard title="Forms by link" href="/modules/public-forms/" description="A form for one record, without an account." />
</CardGrid>