Skip to the content.

@tgmc/nuxt-layer-ui

Nuxt 4 layer with PrimeVue and the Ui* component kit. It extends @tgmc/nuxt-layer-base, so an app that extends it also gets the theme stylesheet, Sass auto-use, @nuxt/a11y, @nuxt/icon and the a11y shell components. core/web and @tgmc/web-layer-admin extend it; core/admin gets it through @tgmc/web-layer-admin. The wider layer design is in nuxt-layers.md. Component rules (folders, naming, API, tests): UI components.

What it provides

The layer registers no imports.dirs: Nuxt scans its own app/composables, and the components entry points at app/components/ui with pathPrefix: false. The ui module adds the toast plugin and, with media on, the media components directory.

Tier 2 composites

Component Job
UiForm The <form> for a useForm() controller: novalidate, aria-busy while saving, the context for its parts.
UiFormField One labelled control: label, hint, error and the aria-* wiring, through the slot { field, invalid }.
UiFormErrorSummary After a failed submit: the number of problems and a link to each invalid field.
UiFormActions The action row and the visible “Saving…” / saved line.
UiConfirmDialog A yes / no alertdialog on UiDialog, Cancel focused first; the leave dialog uses it.
UiConfirmInline “Delete X? [Delete] [Cancel]” in place of the control that asked; Cancel focused first, Escape cancels.
UiUndoNotice “Deleted X. [Undo]” per undoable delete, with a hint naming the window (“Available for 8 seconds; waits while you point at it or focus it.”, from the controller’s delayMs); the time stops on hover or focus; holdSpace keeps the space.

The four form parts render the same native markup in both stacks. Reference: UI components § Forms and, for the two delete parts, UI components § Lists and deletes.

What the app keeps

Usage

// nuxt.config.ts
export default defineNuxtConfig({ extends: ['@tgmc/nuxt-layer-ui'] });

Declare "@tgmc/nuxt-layer-ui": "*" in the app’s dependencies. primevue and @primevue/nuxt-module (version "4", the root’s range) and @tgmc/media-client / @tgmc/media-player are optional peers: an app declares the ones whose feature it keeps on (core/web and core/admin list the PrimeVue pair themselves) or turns the feature off (nuxt-layers.md § 1a). @primeuix/themes arrives through @tgmc/theme/primevue. In @tgmc/web and @tgmc/admin, the layer is in nitro.externals.inline.

The layer depends on @standard-schema/spec (types only), so useForm() takes any Standard Schema library. Apps add zod (or another Standard Schema library) themselves; the layer has zod only as a devDependency for its tests. @tgmc/web-layer-admin and core/web declare zod ^4.6.7.

core/admin registers no core/web component or composable paths: the kit, useUiStack and the toast plugin come from this layer, and the overlay helpers from the base layer.

Why the layer has a browserslist

The CSS pipeline picks the browserslist of the nearest package.json. While the kit sat inside core/web it compiled against web’s targets; in packages/nuxt-layer-ui it would fall back to the default query and emit older output (#0000 became transparent, :is(…) was expanded, -o-object-fit was added). The layer’s package.json therefore carries the same browserslist as core/web, and tests/config.spec.ts pins the two together. Admin’s own SFCs, outside the kit, still compile with the default query as before.

Development