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
Core Concepts

Components

The atomic content unit in CWA — what a component is, what it consists of, and the patterns you'll use most.

What Is a Component?

A component is the smallest unit of managed content on a page. Every piece of visible content — a heading, a block of rich text, an image, a call-to-action button, a conference card — is a component.

Components are:

  • Stored in the API as entities in your database (each type is a PHP class)
  • Rendered by the Nuxt module using matching Vue files
  • Edited inline in the browser by editors without leaving the page

A Component Has Two Sides

1. The PHP entity (the data)

#[Silverback\Publishable]
#[ApiResource(mercure: true)]
#[ORM\Entity]
class Title extends AbstractComponent
{
    use PublishableTrait;

    #[ORM\Column(nullable: true)]
    public ?string $title = null;
}

AbstractComponent gives it identity (IRI, UUID) and the uiComponent field. You add your own data fields.

2. The Vue component (the display)

<!-- app/app/cwa/components/Title/Title.vue -->
<template>
  <h1>{{ resource?.data?.title || 'No Title' }}</h1>
</template>

<script setup lang="ts">
import type { IriProp } from '#cwa/composables/cwa-resource'
import { useCwaComponent, defineCwaConfig } from '#imports'

defineCwaConfig({
  name: 'Title',
  description: 'The main heading of a page',
  icon: 'heading',
})

const props = defineProps<IriProp>()
const { resource, exposeMeta } = useCwaComponent(props)
defineExpose(exposeMeta)
</script>

The module passes the component's IRI as a prop. useCwaComponent reads the resource from the module's store — the module has already fetched it — and stays reactive to updates. defineExpose(exposeMeta) wires the component into the admin manager.

defineCwaConfig holds the component's settings, in its own file: how the Add Component dialog shows it, and any styles editors can choose. There's no list of components to keep in nuxt.config: the module finds each one from its folder in app/app/cwa/components/.

The Admin Tab

An admin tab is a separate Vue file that renders inside the manager panel when this component is selected in edit mode.

app/cwa/components/
└─Title/
├─Title.vuedisplay component
└─admin/
└─Title.vueadmin editing tab
<!-- app/app/cwa/components/Title/admin/Title.vue -->
<template>
  <CwaUiManagerTab>
    <CwaUiInput field="title" label="Title" width="lg" />
  </CwaUiManagerTab>
</template>

<script setup lang="ts">
import { useCwaResourceManagerTab } from '#imports'

const { exposeMeta } = useCwaResourceManagerTab({ name: 'Title' })
defineExpose(exposeMeta)
</script>

A tab is one <CwaUiManagerTab> holding the module's admin fields, such as CwaUiInput, CwaUiSelect, CwaUiToggle and CwaUiFileUpload. field="title" binds the input to the component's title: each change is sent to the API as a PATCH a moment after the editor stops typing. There's no save button.

Editing on the page

A tab is a single row, so it has no box for text that runs to several lines. That text is edited on the page instead. In edit mode the template's Title also renders <LazyCwaUiInlineEdit>, so editors can click the heading and type, and HtmlContent is edited in place with TipTap. A tab can point editors there with <CwaUiInlineHandoff field="html" label="Content" />. Component Files has the details.

IMAGE: A Title in edit mode with the heading text being typed on the page, and the manager panel below showing the same value in the Title tab's input
A component's folder has three kinds of file: <Type>.vue displays it, admin/ holds its tabs and ui/ its other looks. A helper component goes in _parts/, which the module ignores.
VIDEO: Typing in a component's admin tab and the rendered component updating live on the page behind the manager panel, with no save step

Component Patterns

Looking at real-world usage, a few patterns come up constantly:

PatternExampleWhat it needs
Text fieldTitle, TextBlockuseCwaComponent + a CwaUiInput in the tab, as in Your First Component
File uploadImage, HeroSectionuseCwaComponent + withFile() + a CwaUiFileUpload in the tab, see Images & Media
Rich textHtmlContentuseCwaComponent + a TipTap editor on the page, see HTML Content
LinkNavigationLinkText + Route/URL fields, see <CwaLink>
Parent + childrenAccordion, GalleryCwaComponentGroup inside the parent component, see <CwaComponentGroup>
FormContact formA Form/ui/<Name>.vue variant of the module's own Form component, see Forms
Collection listingBlog listBuilt-in Collection component, see Collections & Pagination

Alternative UI Variants

A component can have more than one look. The same NavigationLink data might render as a plain text link, a filled button, or an icon, depending on what an editor selects.

There are two ways to provide them:

  1. Styles — declared in defineCwaConfig as styles: { key: { label, classes } }. The component stores the keys an editor picks (as style:<key> in uiClassNames), and the module applies their classes to its root element
  2. UI variants — create app/app/cwa/components/Title/ui/AlternativeName.vue as a full alternative template. It registers as CwaComponentTitleUiAlternativeName, the name the admin stores in uiComponent when it is picked. A variant offers the component's styles unless it declares its own

Both approaches are covered in the Alternative UI Variants guide.

Publishing

Most components use the #[Silverback\Publishable] annotation. This means:

  • Editors change a draft version — the live site is unaffected
  • Changes become live when the editor clicks Publish
  • Mercure broadcasts the update so visitors see the new content in real-time

See Draft & Publish for details.

Next: Draft & Publish

Draft & Publish explains how a publishable component's draft and published versions work.