CWA 2 is a prerelease (2.0.0-alpha), heading for a beta. It runs production sites; configuration can still change between releases, always with upgrade notes. View versions and support
Cwa Layer

The CWA Layer

The CWA layer — what the module auto-provides, how to override it, and how to use its reusable components in your own pages.

The @cwa/nuxt module ships as a Nuxt layer. A layer is a self-contained Nuxt application whose pages, layouts, components, and plugins are merged into your project automatically. You add the layer with extends: ['@cwa/nuxt/layer'] in nuxt.config.ts (see Module Setup for why the package name beats a node_modules path), and the layer registers the module for you — not the other way round. Registering the module directly under modules leaves out the layer's auth pages, admin panel, root layout and middleware.

What the Layer Provides

Pages (auto-registered)

CWA registers several pages automatically. These work out-of-the-box and require no configuration:

Auth pages (public): /login, /forgot-password, /reset-password/[username]/[token], /verify-email/[username]/[token] and /confirm-new-email/[username]/[newEmail]/[token]. See Auth Pages for the component and composable behind each.

Content pages (dynamic, SSR):

RoutePurpose
/ and /*Catch-all CWA content route — resolves routes from the API manifest and renders your layout + page template

Admin panel (client-only, admin users only): the pages under /_cwa, for layouts, pages, page data, routes, users, site settings and orphaned resources. Admin Panel › Admin Routes lists every route.

Layout

cwa-root-layout is registered by the layer. It is the Nuxt layout used on all CWA content pages. It mounts the admin header and resource manager panel when auth.isAdmin is true, then renders the <slot /> — which is where your CWA-resolved layout component appears.

cwa-root-layout is applied automatically to every page that doesn't set its own layout (change the name it registers under with the cwa.layoutName option).

A page of your own that isn't CWA-managed content must set cwa: { disabled: true } in definePageMeta, or the global CWA route middleware asks the API for a Route at its path. See definePageMeta CWA Options.

Route Middleware

Besides the global route resolver, the layer ships two named middleware for guarding your own pages: cwa-auth (a signed-in user) and cwa-admin (a content admin, with ROLE_CMS_ADMIN). They only run on pages that ask for them, and the layer's own /_cwa admin pages use cwa-admin. See Protecting Pages.

Reusable UI Components

The layer registers a kit of <CwaUi...> components that the admin panel is built from. Use them in your own manager tabs, dialogs and admin pages.

A field is bound with exactly one of field="<property>" (inside a <CwaUiManagerTab> or <CwaUiDialog>), :model (a useCwaResourceModel result) or v-model (a value that isn't saved). Each takes its own label. See Component Files › Binding a Field.

ComponentDescription
<CwaUiManagerTab>The root of a manager tab. Lays its fields out in the manager bar's row
<CwaUiInput>One line of text. type, width (xs, sm, md, lg, full), placeholder, nullable, readonly, revealable for a password
<CwaUiNumber>A number with steps: min, max, step, noun. With optional, emptying it saves null; without it, an emptied field goes back to its value
<CwaUiSecretInput>A write-only value such as an API key, read back as { set }: Set with Replace and Remove, never the value. See Admin Pages › Secret Fields
<CwaUiDescriptorFields>A field for each CwaFieldDescriptor in fields, under path, in a dialog with a form. See Admin Pages › Fields From Descriptors
<CwaUiToggle>A boolean switch
<CwaUiSelect>One choice from options of string values. nullable and noneLabel add a None option
<CwaUiMultiSelect>Several choices, stored as an array of strings
<CwaUiSegmented>One choice from a few options, shown as buttons
<CwaUiDatePicker>Date and time field with a calendar popover, in UTC ISO strings. See Date and Time Pickers
<CwaUiResourceSearch>Searches an endpoint and stores the IRI of the resource picked
<CwaUiFileUpload>Upload, replace and remove a file. Takes field, or a useCwaResourceUpload result as :upload
<CwaUiLinkInput>A page or a URL, saved to the route and rawPath fields
<CwaUiInlineHandoff>A preview of a field edited on the page, with Edit on page
<CwaUiInlineEdit>Short text edited where it sits on the page. Takes :model. Use it as <LazyCwaUiInlineEdit> behind $cwa.admin.isEditing
<CwaUiEditPlaceholder>An empty box with a label, for an empty component in edit mode. Use it as <LazyCwaUiEditPlaceholder>
<CwaUiTextarea>Multi-line text, for dialogs and admin pages. It renders nothing in a manager tab
<CwaUiFieldPresence>Wraps a field of your own and outlines it with the name of another admin who has it in focus. Takes :model; bind the model's focusListeners on it. See useCwaResourceModel › Your Own Field Editor
<CwaUiRemoteChangeConflict>The Name changed this · Use theirs / Keep mine line. Takes a model's remoteChange as :change
<CwaUiButton>A button: label, variant, tone, size, icon, loading, disabled with a disabledReason
<CwaUiAlert>A notice, with a tone (info, success, warning, danger) and a title. <CwaUiAlertInfo> and <CwaUiAlertWarning> are shorthands
<CwaUiDetailList>Read-only labelled values, from items of { label, value }. See Admin Pages › Read-Only Details and Tables
<CwaUiDataTable>A read-only table: columns of { key, label, align? }, rows and a label for screen readers
<CwaUiProgressBar>Animated progress bar. For the page loading bar, use <CwaLoadingIndicator> in app.vue instead
<CwaUiHamburger>Mobile hamburger icon
<CwaUiCalendar>Calendar for a date, a range or several dates
<CwaUiInputDate>Segmented date and time field without the calendar

useCwaToast() shows a short notice in the admin, and useCwaConfirm() asks the admin to confirm an action.

The spinner isn't registered as a component. Import it from #cwa/templates/components/ui/Spinner.vue; it takes a size and is shown while it renders, so wrap it in a v-if. Give it a label for screen readers:

<span v-if="loading" role="status" class="inline-flex">
    <Spinner />
    <span class="sr-only">Loading</span>
</span>

These components are styled with CWA's bundled CSS (cwa.css). They are primarily intended for admin and auth pages, but you can use them anywhere.

Overriding Layer Pages

Any page the layer provides can be overridden by creating the same path in your project's app/app/pages/ directory. Nuxt's layer merging means your file wins:

app/app/pages/login.vue         ← your override, takes precedence
                                ← layer's /login is ignored

See Customising the Login Page for an example.