Skip to content

UI kit and brand theming

The UI kit (ui-kit/ in the framework repository) is a language-neutral set of components in plain HTML, Tailwind CSS and Datastar: no Node at run time, no JavaScript files, behaviour carried by attributes. Server templates in any language are written from its specs. Today there are two implementations, templ in Go and JTE in Java, and both must render every fixture identically.

For the Nuxt UI package the kit is a checklist of behaviours rather than a markup contract: the specs’ purpose, variants, states, behaviour and accessibility sections and the colour tokens apply, the golden HTML does not.

Path What
components/ One spec per component, plus _conventions.md (read it first)
theme/tokens.css, theme/fc-components.css, theme/kit.css CSS custom properties (light and dark), the Tailwind @theme, and the hand-built .fc-* classes
icons/ A Lucide sprite and the script that rebuilds it from a pinned release
fixtures/ Conformance fixtures: props as JSON and golden HTML. Every implementation must render them identically after normalisation
messages/ Message catalogs en.json (the source) and af.json (languages)
gallery/ Every component, variant and state in a browser, light and dark

The component specs cover form controls (input, textarea, select, checkbox, switch, radio group, password input, secret-reference input, search input), feedback (alert, flash banner and stack, badge, tag, spinner, skeleton, progress), surfaces (dialog, alert dialog, confirm dialog, form dialog, sheet, drawer, card, accordion, tooltip, hover card, dropdown menu), data (table, data table, paginator, cursor pager, pagination, table toolbar, row actions, pick list, multi-select, search select, autocomplete, tab list), content (Markdown, JSON block, code block, code chips, code editor, diagram), layout (app shell, sidebar, page header, form section, detail field) and locale-aware display (local time, number, money, quantity). Each spec states its purpose, exact HTML, parts and options, accessibility and behaviour.

  1. Prefer the browser. <details>, <dialog>, popover, native inputs, links, forms and CSS :has().
  2. Datastar only where state is needed: selected tab, sidebar collapse, drawer record, client filter and sort, dirty form, pick list, dialog open and close. Server round trips are @get, @post and @delete actions whose replies are datastar-patch-elements events.
  3. Dialogs open with Datastar (showModal()), not commandfor, which is not yet universal in browsers.
  4. No JavaScript files in the kit itself. Two heavy features are islands, scripts a page names explicitly: the code editor (CodeMirror) and the diagram (Mermaid). Their components render a native fallback (a <textarea>, the source text) that works without the script.
  5. Accessibility is part of the spec: roles, labels, focus order and keyboard operation.
  6. Signals are page-global: give every stateful instance its own signal name.

An application can carry its own name, logo and colours. The two UIs do this differently.

The app shell takes a brand in its props. It replaces the FlowCatalyst bolt in the sidebar header and in the narrow-screen top bar. Every field is optional; with none set the markup is unchanged.

Field Meaning
name The logo’s accessible name: the image’s alt, or the bolt’s aria-label. Defaults to Logo for an image and FlowCatalyst for the bolt
logoUrl An image URL. It passes the URL check, so data: and script schemes are blocked
logoSvg SVG markup, used when logoUrl is empty. The kit writes it as <img src="data:image/svg+xml;base64,..."> and never inline, so whatever the markup holds cannot run
logoHeight The header height in CSS pixels. 0 or less means 32
props := kit.AppShellProps{
LogoHref: "/ui/",
Brand: kit.Brand{Name: "Acme", LogoURL: "https://cdn.example.com/acme.png", LogoHeight: 40},
// Nav, User, ...
}

Colours. The sidebar and top bar colours are CSS custom properties with the navy look as fallbacks. A page re-colours the shell by setting them on :root in its own stylesheet:

Property Default
--fc-sidebar-background linear-gradient(180deg, #102a43 0%, #0a1929 100%)
--fc-topbar-background linear-gradient(90deg, #102a43 0%, #0a1929 100%) (below 768px)
--fc-sidebar-accent #47a3f3 (the bolt, the current item, focus outlines)

The values are CSS. If they come from configuration, validate them as a colour or gradient before writing them into a <style>; never write free text there.

Light and dark mode come from the fc_theme and fc_scheme cookies, rendered by the server (see server-rendered pages). An application with its own templates builds its own stylesheet: an input file that imports the kit theme and adds @source lines for its templates. Tailwind runs as a standalone CLI, so no Node is needed in the application’s build.

Theming follows Nuxt UI. Three layers:

  • Colour aliases. nuxtUiOptions() maps Nuxt UI’s aliases to Tailwind palettes: primary emerald, secondary blue, success green, info sky, warning orange, error red, neutral slate. Change them with nuxtUiOptions({ colors: { primary: "blue" } }). icons: [...] adds icons that are named only at run time.
  • Tokens. @flowcatalyst/ui/theme.css sets Nuxt UI’s own --ui-* variables (text, background, border, radius, and the aliases for light and dark), the IBM Plex Sans font, and the navy palette (--color-navy-50 to 950, --color-accent-*) used by the shell’s sidebar. An application overrides a variable in its own CSS after the import.
  • Component looks are Nuxt UI variants held in fcComponentTheme, passed through the Vite plugin’s ui option (the equivalent of Nuxt’s app.config). Nothing is copied from the kit’s CSS.

The package’s colour choices are one shade darker than the kit’s for the primary, success, info, warning and error aliases, because the kit’s shades failed WCAG AA 4.5:1 in some uses. Under the strict policy the colour variables are emitted as a real stylesheet at build time, not as inline styles. See the Nuxt UI package.

The Nuxt UI app shell’s logo and navigation are supplied by the application (FwAppShell takes the application name and a navigation list filtered by permission).

Each fixture directory holds props JSON and the expected HTML. Both implementations decode the props strictly (an unknown property fails the case), fill only slots the component has, and compare with the golden HTML after a normaliser. They check both directions: a fixture without a renderer fails, and a renderer without a fixture fails. A new component therefore arrives as a spec, fixtures, and a renderer in each language in the same change.

The normaliser sorts each element’s attributes, collapses whitespace in attribute values and in text, and keeps class token order. A style value is compared without a trailing ; (height: 32px equals height: 32px;), because a template engine may end every style value with one.

The component markup and Tailwind class strings derive from the MIT-licensed Topcoat UI registry. The notice travels with any copy of the kit’s files. The Datastar, Mermaid and CodeMirror bundles are pinned by hash and served with their licence notices.