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
Admin Manager

useCwaResourceManagerTab

Register a Vue file as a tab in the admin manager panel and get the IRI of the currently selected component.

Every admin tab file in app/app/cwa/components/*/admin/ must call this composable. It registers the file as a tab and returns the IRI of whatever component is currently selected. The tab's template is one <CwaUiManagerTab> holding kit fields:

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

const { exposeMeta } = useCwaResourceManagerTab({ name: 'Title' })

defineExpose(exposeMeta)
</script>

<template>
  <CwaUiManagerTab>
    <CwaUiInput field="title" label="Title" width="lg" />
  </CwaUiManagerTab>
</template>

Component Files › Part 2: Admin Manager Tabs lists the kit fields and how each is bound.

Signature

useCwaResourceManagerTab(options: {
  name: string              // tab label in the manager panel
  order?: number            // sort position; lower = left (optional)
  disabled?: boolean | Ref<boolean>   // hide the tab
})

Parameters

ParameterTypeDescription
options.namestringThe tab's label in the manager panel
options.ordernumberSort position; lower numbers appear first. See Built-in tabs
options.disabledboolean | Ref<boolean>Hide the tab. A plain boolean is read once at setup; pass a ref or computed to toggle it. See Conditional disabled

Return Values

const { exposeMeta, iri, resource } = useCwaResourceManagerTab({ name: 'Title' })
ReturnTypePurpose
exposeMetaobjectPass to defineExpose — required
iriComputedRef<string | undefined>IRI of the currently selected component; pass to useCwaResourceModel when you create a model yourself
resourceComputedRef<Resource | undefined>The full resource object for the selected component
$cwaCwaComposableThe CWA instance
createComputedState<T>(propName: string, initialValue?: T) => WritableComputedRef<T>A writable computed backed by the resource stack manager's shared tab state — used by the built-in Order tab

Both iri and resource are undefined when nothing is selected, which is why useCwaResourceModel accepts Ref<string | undefined>.

defineExpose(exposeMeta) is required in every admin tab file.

A kit field given field="title" creates its own model for this IRI. iri is for a model you create yourself, to pass as :model:

const { exposeMeta, iri } = useCwaResourceManagerTab({ name: 'Title' })
const titleModel = useCwaResourceModel<string>(iri, 'title')
// <CwaUiInput :model="titleModel" label="Title" />

The manager bar shows a selection's tabs once they have all loaded. In development, a tab that renders no <CwaUiManagerTab> logs a warning naming it.

Multiple Tabs

Each admin tab is a separate file. Each file calls useCwaResourceManagerTab with its own name:

app/app/cwa/components/Article/admin/
  Content.vue   →  useCwaResourceManagerTab({ name: 'Content', order: 1 })
  Media.vue     →  useCwaResourceManagerTab({ name: 'Media', order: 2 })
  Settings.vue  →  useCwaResourceManagerTab({ name: 'Settings', order: 3 })

All appear as tabs in the manager panel when an Article component is selected.

Conditional disabled

Call the composable once — only the exposeMeta you pass to defineExpose is read by the manager, so a second call to set disabled has no effect. Derive the condition from the selected resource before the call:

const cwa = useCwa()
const currentIri = cwa.admin.resourceStackManager.currentIri
const isAdvanced = computed(() =>
  currentIri.value
    ? cwa.resources.getResource(currentIri.value).value?.data?.enableAdvanced === true
    : false,
)

const { exposeMeta } = useCwaResourceManagerTab({
  name: 'Advanced',
  disabled: computed(() => !isAdvanced.value),})
defineExpose(exposeMeta)

Built-in Tabs

The module adds its own tabs depending on the selected resource — Info (order 51), plus UI, Order and Publish for components (the UI tab offers the component's UI variants and styles), Group for component groups, and Dynamic Component / Data Placeholder for positions. All of them use DEFAULT_TAB_ORDER (50), exported from #cwa/admin/manager-tabs-resolver.

Tabs are sorted ascending by order, and a tab with no order is treated as 0. So use an order below 50 to appear before the built-ins, and above 51 to appear after them:

import { DEFAULT_TAB_ORDER } from '#cwa/admin/manager-tabs-resolver'

useCwaResourceManagerTab({ name: 'Content', order: DEFAULT_TAB_ORDER + 10 })