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.
What is in the kit
Section titled “What is in the kit”| 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.
Conventions
Section titled “Conventions”- Prefer the browser.
<details>,<dialog>,popover, native inputs, links, forms and CSS:has(). - 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,@postand@deleteactions whose replies aredatastar-patch-elementsevents. - Dialogs open with Datastar (
showModal()), notcommandfor, which is not yet universal in browsers. - 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. - Accessibility is part of the spec: roles, labels, focus order and keyboard operation.
- Signals are page-global: give every stateful instance its own signal name.
Brand and theming
Section titled “Brand and theming”An application can carry its own name, logo and colours. The two UIs do this differently.
Server-rendered pages
Section titled “Server-rendered pages”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, ...}Props.AppShell takes a Props.Brand (name, logo URL, logo SVG, logo height) as its last component. The
shorter constructor without it still renders the FlowCatalyst bolt. ShellBrand holds the rules the
templates apply: the logo URL passes Markup.url, the SVG becomes a base64 data: image the kit builds,
and a height of 0 is 32.
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.
Nuxt UI package
Section titled “Nuxt UI package”Theming follows Nuxt UI. Three layers:
- Colour aliases.
nuxtUiOptions()maps Nuxt UI’s aliases to Tailwind palettes:primaryemerald,secondaryblue,successgreen,infosky,warningorange,errorred,neutralslate. Change them withnuxtUiOptions({ colors: { primary: "blue" } }).icons: [...]adds icons that are named only at run time. - Tokens.
@flowcatalyst/ui/theme.csssets 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-50to950,--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’suioption (the equivalent of Nuxt’sapp.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).
Fixtures and conformance
Section titled “Fixtures and conformance”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.
Third-party notices
Section titled “Third-party notices”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.