Get Started with ModUI
Use @gxp-dev/mod-ui for dashboard composition and JSON-driven builders. Follow AppUI installation for attendee-facing apps instead. These examples assume a Vue application with the package's supported peers and an ES-module-capable build.
Install and initialize
pnpm add @gxp-dev/mod-ui
Check the installed package's peer requirements. Its package metadata declares Vue 3.4+, Pinia 2.2 or 3, and validation/UI dependencies. The current TextInput source uses Vue's useTemplateRef, introduced in Vue 3.5; these examples were checked with Vue 3.5.35. Use Vue 3.5 for this source snapshot rather than assuming every component works on the declared minimum. Install missing peers through the package manager; do not copy the old ComponentKit global-plugin installation pattern.
A standalone host supplies Pinia once:
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
createApp(App).use(createPinia()).mount('#app')
Use the existing app/store when integrating into a platform host. The component library does not create an admin login or provide project API credentials.
Props-based input
Use named exports, bind model state and respond to emitted intent:
<script setup lang="ts">
import { ref } from 'vue'
import { Button } from '@gxp-dev/mod-ui'
import { TextInput } from '@gxp-dev/mod-ui/input'
const firstName = ref('')
const message = ref('')
function inspect() {
message.value = firstName.value.trim()
? `Entered: ${firstName.value.trim()}`
: 'Enter a first name.'
}
</script>
<template>
<TextInput v-model="firstName" label="First name" required />
<Button type="button" @click="inspect">Inspect value</Button>
<p role="status">{{ message }}</p>
</template>
The example displays a local value; it does not store an attendee. To save platform data, call the application's authorized service and display its actual success/validation result.
JSON-driven page
The current library's ShowPage requires config; item is optional and defaults to an empty object, while formId defaults to show-page-default. Existing platform wrappers can retain their own legacy prop names; do not apply those wrapper signatures directly to this package.
<script setup lang="ts">
import { computed, onUnmounted } from 'vue'
import { ShowPage, Button, useFormDataStore } from '@gxp-dev/mod-ui'
import type { ShowPageConfig } from '@gxp-dev/mod-ui'
const formId = 'documentation-profile'
const store = useFormDataStore()
store.setInitialValues(formId, { first_name: 'Alex' })
const currentValue = computed(() => store.getForm(formId).values.first_name)
const config: ShowPageConfig = {
title: 'Profile preview',
cards: {
profile: {
id: 'profile',
cardType: 'element-list',
title: 'Details',
elementList: ['first-name'],
},
},
elements: {
'first-name': {
id: 'first-name',
type: 'input.text',
name: 'first_name',
label: 'First name',
required: true,
},
},
}
function showError() {
store.setErrors(formId, { first_name: ['Example server validation error.'] })
}
onUnmounted(() => store.resetForm(formId))
</script>
<template>
<ShowPage :config="config" :form-id="formId" />
<p role="status">Current value: {{ currentValue }}</p>
<Button type="button" @click="showError">Show validation example</Button>
</template>
The card's element IDs resolve through config.elements. Its name is the data key; the element's visual ID is a separate identifier. Editing the input updates that form's values. Server-style errors are set through the same store and rendered by the composition. Use unique form IDs when several forms coexist, and clear/reset the owned form when appropriate. An item supplies display fallbacks; it does not automatically seed every value into the form store. Initialize the full intended values before editing/saving. The renderer prefers a non-null store value, then the item value, then the element default.
Save and delete behavior
ShowPage's Save/Delete controls emit events and call configured page event handlers. A route-looking value in a schema does not establish that your application persisted a record. Connect the intended handler/service, validate the payload, enforce server permission and show actual response errors. Test successful and denied saves and an unchanged model after a failed request.
Event contract and service wiring
| Event | Payload |
|---|---|
save | No arguments |
delete | No arguments |
tab-change | Selected tab ID string |
An updateConfig enables the Save control unless showSaveButton is false. A deleteConfig enables Delete. Choose either a parent event listener or the corresponding config.eventHandlers callback for an operation; wiring both to the same mutation sends it twice.
In the page example, add an appropriate updateConfig and wire a consumer-owned function:
config.updateConfig = { update: { route: 'profile.update', requestType: 'patch' } }
async function saveProfile() {
if (saving.value) return
saving.value = true
store.clearErrors(formId)
try {
// The application supplies this service, its principal, project and route.
// It resolves with the normalized stored profile, not a raw HTTP envelope.
const saved = await profileService.update({ ...store.getForm(formId).values })
store.setInitialValues(formId, saved)
status.value = 'Profile saved.'
} catch (error) {
// Normalize the application's actual error response before this boundary.
const failure = normalizeProfileError(error)
store.setErrors(formId, failure.fieldErrors)
status.value = failure.message
} finally {
saving.value = false
}
}
Define the Vue refs/service/error normalizer in the owning application, then wire the handler and disable the form controls while its request is pending:
<fieldset :disabled="saving">
<ShowPage :config="config" :form-id="formId" @save="saveProfile" />
</fieldset>
<p role="status">{{ status }}</p>
The handler's saving guard prevents a second request; the fieldset also prevents ordinary input edits during that request. Without that wrapper, a late success can replace edits made after submission when setInitialValues adopts the saved response. Keep any additional editing controls inside the disabled boundary. Programmatic updates, other editors and server-side concurrent writes still need application-specific reconciliation/version checks; a fieldset does not provide those guarantees.
The route name above is illustrative configuration; this ShowPage does not issue its HTTP request automatically. Keep failed edits available for correction and use the returned stored values after success. Test the service callback with valid, rejected and repeated requests, then test actual server scope in the target application.
Convert a legacy schema
ShowPage/IndexPage automatically normalize supported legacy v1 shapes at their boundary. For explicit inspection before rendering, use a public adapter:
import { v1ToV2, normalisePageConfig } from '@gxp-dev/mod-ui'
const legacy = {
title: 'Profile',
tabsList: [{
title: 'Details', tabId: 'details',
cards: [{ type: 'fields_list', fieldsList: [{ type: 'text', name: 'first_name', label: 'First name' }] }],
}],
}
const native = v1ToV2(legacy)
const detected = normalisePageConfig(legacy)
Inspect the resulting cards, elements, IDs and dot-notation discriminators, then render and verify binding/visibility. The adapters translate supported shapes; they are not a complete runtime validation service for arbitrary loaded JSON. TypeScript validates authored configuration types, while JSON loaded from a server needs boundary checks for shape, known discriminators, required references and application-specific values. Missing/unknown renderers can show a fallback; absent referenced elements can be omitted. Neither is successful schema validation.
Use the platform's supported schema editor/validation and test the transformed schema before persisting or publishing it. For imported JSON, report structural errors before a user tries to save data rather than relying only on a blank or fallback renderer.
Display conditions and feature/permission context can hide an element or card. They are client presentation controls; a hidden field must also be protected by server authorization and data shaping when needed.
Styles and themes
The reviewed build loads compiled default styles through each public barrel's shared _styles entry. Import an offered optional theme and apply its scope class, for example:
import '@gxp-dev/mod-ui/styles/themes/dark.css'
Place dark on the intended ancestor for that theme. Inspect the selected theme file for its exact class/token contract; platform and kiosk scopes can differ. See the package entrypoint catalog. A source-file path is not a package export. The current package does not declare a root @gxp-dev/mod-ui/styles export.
Verify and troubleshoot
Confirm the example renders, typing updates the intended form value, errors attach to the right data key and two forms stay isolated. Inspect keyboard labels/focus and the target dashboard width. For a blank renderer, check its discriminator, element/card ID mapping and the supported schema adapter. For a save that only changes the UI, inspect the handler and server result. For missing styles, check the declared entry/theme and the consumer build's side-effect handling.
Source review
Reviewed against ModUI a57bc7fe8eb3f1aec2581be52388520463a7d6bf: package.json, src/pages/ShowPage.vue, src/definitions/cards/ElementListCard.ts, src/definitions/elements/InputElement.ts, src/engine/ElementRenderer.vue, src/stores/formDataStore.ts, src/_styles.ts and vite.config.ts on 2026-10-13. The examples are local UI demonstrations; platform resource/permission acceptance is separate.
Check the packaged consumer separately
Run your consumer’s strict type check and production build against the actual release tarball, not only an alias to library source. A library build and a consumer bundle test different boundaries. Confirm the root/subpath imports you use and their styles reach the output; then test mounted behavior and authorized save/validation results separately.
The reviewed 2.0.41 source built in an isolated copy. Both complete Vue examples above were included in an offline packed-consumer type check with strict: true, skipLibCheck: false and types: []. That check failed on missing Bluetooth ambient names in VueUse and a missing DayOfWeek type export used by Reka UI. It used Vue 3.5.35, TypeScript 5.9.3, vue-tsc 2.2.12 and Vite 8.0.14 with existing dependencies. A separate production bundle of the JSON-driven page example passed. A local browser sample of that packed consumer also rendered the form, updated its displayed value while typing, and showed the synthetic field error while preserving the edit. These checks do not resolve the declaration errors or verify real saves, server authorization, multiple-form isolation or every target browser.
Unreleased source fix
A later local ModUI fix at 13982c0 declares the Web Bluetooth type dependency and loads it explicitly from every public declaration entry, including subpaths. It uses @internationalized/date 3.12.4 for the upstream DayOfWeek export, with an aligned date dependency graph. Its packed-consumer check passes with strict: true, skipLibCheck: false and types: [], covering all 33 public type entries, the browser/date type checks and a production ShowPage consumer build.
The source still carries version 2.0.41; this work has not published a replacement package. Do not assume an installed package with that version contains the local fix. Confirm the release's source/artifact, refresh its compatible dependency lockfile and rerun your application's strict check and build. These local results do not verify real server saves, authorization or every target browser; the earlier failed tarball and its UI samples remain separate historical evidence.
For those errors, retain the exact dependency tree, compiler/ambient-type configuration and first failing declaration. Check VueUse’s browser ambient types and the resolved Reka UI/date-library versions with the library maintainer. types: [] deliberately limits automatic ambient types; other host configurations can behave differently. Disabling declaration checking is not evidence that the strict consumer passes. Verify the intended package/toolchain/host combination before accepting it; this local check does not certify a published registry artifact.