@flowcatalyst/ui
@flowcatalyst/ui is the front-end package shared by applications built on the
application framework (Java reference implementation and Go). It is Nuxt UI v4 on
plain Vue 3 and Vite (no Nuxt, no Nitro), in strict TypeScript. It gives an application a themed
shell, list and form pages, a signed-in session, and the standard administration pages, so the
application writes only its own screens.
The package builds on @flowcatalyst/api-runtime, which supplies the
session, the configured client and the error envelope. The framework-level view (how these pieces
fit a service, forms, i18n) is in the UI section of the framework guide.
Design rule: use a Nuxt UI component directly whenever one fits; an Fw* part exists only where
FlowCatalyst adds behaviour (the framework repository’s docs/ui/nuxt-native.md says which and why).
Distribution
Section titled “Distribution”The package is private and unversioned (0.0.0). It is not published to a registry and has no
release tags. It exports TypeScript and Vue source, which your application’s Vite build compiles,
and you link it by path from a checkout of the framework repository:
{ "dependencies": { "@flowcatalyst/ui": "link:../flowcatalyst-framework/ui/packages/ui", "@flowcatalyst/api-runtime": "link:../flowcatalyst-framework/ui/packages/api-runtime", "@flowcatalyst/push": "link:../flowcatalyst-framework/ui/packages/push" }}Install
Section titled “Install”Everything the package imports is a peer dependency. pnpm installs nothing for a link:
package, and the bundler resolves its imports from the package’s real path, which is outside your
lockfile. So your application declares these itself, at the versions in the framework workspace’s
catalog (ui/pnpm-workspace.yaml):
@nuxt/ui, tailwindcss, vue, vue-router, zod, @vueuse/core, reka-ui and
@fontsource-variable/ibm-plex-sans, plus an icon set such as @iconify-json/lucide.
@axe-core/playwright and @playwright/test are optional peers, needed only for the end-to-end
kit. Its real dependencies are @flowcatalyst/api-runtime and @flowcatalyst/push (the push reader), which you link as well.
Node 24 and pnpm 10 are used by the framework workspace.
import ui from "@nuxt/ui/vite";import { flowcatalystUi, nuxtUiOptions } from "@flowcatalyst/ui/vite";import vue from "@vitejs/plugin-vue";import { defineConfig } from "vite";
const options = nuxtUiOptions(); // theme, explicit imports, bundled icons, colour mode offexport default defineConfig({ plugins: [vue(), ui(options), flowcatalystUi(options)] });Two exports share the name flowcatalystUi: the Vite plugin from @flowcatalyst/ui/vite (here) and
the Vue plugin from @flowcatalyst/ui (in the entry file below). The Vite plugin de-duplicates vue, vue-router, @nuxt/ui, @vueuse/core, reka-ui and
zod, so a linked package does not bring a second copy. It also writes the pre-paint colour-mode
snippet into index.html and a csp-hashes.json beside it ({"scriptHashes": [...]}, every inline
script of the built HTML) for the server’s Content Security Policy.
Entry file and CSS
Section titled “Entry file and CSS”// main.ts: @flowcatalyst/api-runtime FIRST (it makes Zod CSP-safe before any schema exists)import { createApiRuntime, installSessionGuard } from "@flowcatalyst/api-runtime";import { flowcatalystUi } from "@flowcatalyst/ui";import ui from "@nuxt/ui/vue-plugin";import { createApp } from "vue";import { client } from "./api/client.gen";
const api = createApiRuntime({ clients: [client] });installSessionGuard(router, api.session, { notPermitted: () => "/not-permitted" });createApp(App).use(router).use(ui).use(flowcatalystUi, { api }).mount("#app");/* the one CSS entry */@import "tailwindcss";@import "@nuxt/ui";@import "@flowcatalyst/ui/theme.css";App.vue wraps everything in Nuxt UI’s UApp. The application’s tsconfig maps #build/ui and
#build/ui/* to its own node_modules/.nuxt-ui/ui, and extends the presets
@flowcatalyst/ui/tsconfig.base.json and @flowcatalyst/ui/tsconfig.generated-client.json by
package name (see the framework’s ui/README.md for the full tsconfig files and a pitfall with
project references to the runtime’s generated client).
Plugin options
Section titled “Plugin options”app.use(flowcatalystUi, options) takes:
| Option | Meaning |
|---|---|
api |
The ApiRuntime from createApiRuntime. Provides the session to useSession, usePermissions and the shells. |
admin |
The port for the standard admin data pages: your application code and the operations of your generated client. Needed by standardAdminPages. |
The plugin also applies the stored colour mode for the whole application.
Exports
Section titled “Exports”The root export @flowcatalyst/ui contains everything below. Other entry points: /vite
(flowcatalystUi, nuxtUiOptions), /push (the push composables, below; imports no Nuxt UI), /csp, /theme and /theme.css, /e2e (the end-to-end kit),
and the two tsconfig presets.
Layouts and pages
Section titled “Layouts and pages”| Export | Use |
|---|---|
FwAppShell |
The application frame: navigation, navbar, user menu and colour mode. Props: appName, navigation (a FwNavItem[]), pageTitle?, user? (defaults to the session’s), width? ("contained" or "full"). Emits sign-out; with a runtime the shell signs out itself. Slots: default, navbar. |
FwAdminShell |
The shell for the administration area, driven by adminNavigation and the permissions of the session. |
FwStandalonePage |
A page outside the shell. |
FwSignedOutPage, FwSignInFailedPage, FwUnavailablePage |
The pages every application needs outside the shell. signInFailureMessage and SIGN_IN_FAILURE_MESSAGES map a sign-in failure code to text. |
Partials
Section titled “Partials”Pages assembled from parts, for the common cases: FwListPage (filters, sorting, cursor paging),
FwFormPage, FwFormDialog, FwRecordDrawer (a record in a drawer backed by a child route).
Components
Section titled “Components”FwAlertDialog, FwAnnouncer (screen-reader announcements), FwCodeBlock, FwCodeChips,
FwColorModeButton, FwCursorPager, FwDetailField, FwDetailList, FwFormSection,
FwJsonBlock, FwLocalTime, FwPaginator, FwPickList, FwRowActions, FwStatusBadge,
FwTableToolbar, FwToggleGroup.
Composables
Section titled “Composables”| Composable | Purpose |
|---|---|
useSession, usePermissions, useApiRuntime |
The session, user, and can(permission) from the provided runtime. |
useListState with stringFilter, booleanFilter, numberFilter, arrayFilter, choiceFilter |
URL-backed list state: filters, page and sort live in the query string, so a list is linkable and survives a reload. Changes replace the history entry. |
useCursorPagination |
Cursor-based paging helpers. |
useDirtyForm(snapshot, { guardRouteLeave }) |
Tracks unsaved changes and asks “Discard changes?” before leaving the route. markClean(), reset(). |
useDrawerRoute |
A drawer whose open state is a child route. |
useConfirm, confirmDiscardChanges |
Confirmation dialogs. |
useFlash |
Flash messages. |
announce, announcements |
Screen-reader announcements. |
useRequestFailureToasts |
Toasts for refused, failed and offline requests from the runtime. |
useColorMode |
Light, dark or system, stored in the browser. |
useLocalState |
Per-browser persisted state. |
optionalText, optionalNumber |
Helpers for optional form fields. |
Exported from @flowcatalyst/ui and from @flowcatalyst/ui/push. They read pushes through @flowcatalyst/push (the reader core: PushCore, PushStream, no DOM).
| Export | Purpose |
|---|---|
providePushHub(options), createPushHub(options), usePushHub() |
One push stream per page. options: baseUrl, fetch (the subscribe; default same-origin with the session cookie), streamFetch, getTickets, eventTypes. createPushHub is the same without provide, for tests. The hub exposes state, error, lastPushAt, denied, on(pattern, fn) and onReset(fn). |
usePushTopics(topics) |
Holds topics (a ref or getter) from mount to unmount. Reference-counted; at most 100 topics (MAX_TOPICS), else PUSH_LIMIT in hub.error. |
useLiveList({ topics, load, id, version, toChange }), rowChange |
A list kept current by pushes under the version rule. Returns rows, status, lastAppliedAt, apply, reload, error. rowChange maps row.upserted and row.removed pushes. |
useLiveRecord({ topics, load, version, signal }) |
A record read again when a push signals a higher version. Returns record, status, lastAppliedAt, error, reload. |
compareVersions, versionGreater |
The version comparison the composables use. |
See Push to clients for the ordering rules.
Also exported: tokenize (syntax highlighting for code and JSON), localText and utcText (time
formatting).
Standard admin pages
Section titled “Standard admin pages”An application that mounts the framework’s administration module can add the same console pages the platform’s own services have, without writing them:
import { standardAdminPages, adminRoutes, adminNavigation } from "@flowcatalyst/ui";
const pages = standardAdminPages("orders"); // the application code of the AdminModulestandardAdminPages(application, ids?) returns AdminPage definitions in navigation order. The ids
are about, event-types, roles, users, activity, config and platform-config; pass a
subset when the server has only some sections. replaceAdminPage swaps one for your own.
adminPermissions(application) names the permissions the pages check. The data pages need the
admin plugin option so they can call your application’s generated client. The platform-config
page needs the four platform-config admin operations in the application’s API and the view, manage,
reveal and all-clients permissions. The server side is described in
Admin.
Content Security Policy helpers
Section titled “Content Security Policy helpers”strictContentSecurityPolicy(scriptHashes?) returns the policy the framework serves: default-src 'self', script-src 'self' plus the given hashes, style-src 'self', img-src 'self' data:,
font-src 'self', connect-src 'self', frame-ancestors 'none' and base-uri 'none', with no
'unsafe-inline' and no nonce. The default hash is COLOR_MODE_SNIPPET_SHA256, the colour-mode
script. strictSecurityHeaders returns the full header set. A Java or Go server does not need to
copy hashes: it reads csp-hashes.json from the build. See
Static assets and the SPA.
Errors
Section titled “Errors”The package surfaces request failures through useRequestFailureToasts and the runtime’s
ServiceError; see @flowcatalyst/api-runtime. Use
applyServiceError to put a 400 on a form, and adminDataOrThrow and adminFailureText in
custom admin pages.
Testing
Section titled “Testing”The framework workspace tests components and composables with vitest (pnpm test) and runs a
gallery application under a strict CSP with Playwright and axe (pnpm gallery:e2e), failing when a
row of the platform behaviour checklist is exercised by no passing test. Applications get the same
checks through @flowcatalyst/ui/e2e; see the framework’s end-to-end kit guide. Build the types
before type-checking (pnpm build writes Nuxt UI’s generated theme types), then pnpm typecheck
and pnpm lint.