Skip to content

Migrate Cratis Components from 2 to 3

Use this historical guide only when Cratis Components 3 is your intended target: it moves Components 2 applications from PrimeReact 10 to PrimeReact 11. If you want Components 4, migrate directly from Components 2 instead; you do not need to adopt PrimeReact 11 first.

The Components 3 reference links are pinned to commit 080a441 so their APIs and styling instructions cannot drift to Components 4. They describe the later Components 3 source at that commit, not necessarily every 3.0 patch. For dependency ranges, use the manifest of the exact Components 3 version selected by your lockfile.

Read PrimeReact’s Updating to v11 guide for controls you import directly. The steps below cover the Components boundary, including its wrapper APIs and stylesheet setup.

  1. Preserve the working Components 2 source, package manifest, and lockfile together. Run the application’s existing lint, type checks, specs, and production build; resolve baseline failures before starting.
  2. Confirm that Components 3 is the intended target and review PrimeUI licensing before changing dependencies. Select a version within >=3 <4, install its declared peers, and update removed imports. Do not install unversioned Components or use latest for this historical migration.
  3. Import tokens and styles, choose a theming path, and configure the provider and license. Stop here to run the application checks and inspect overlays and form fields. Save a checkpoint only when those checks pass.
  4. Review the reduced capabilities and custom CSS sections below. Exercise affected controls with keyboard navigation, including a select inside a dialog, and check the application’s light and dark themes. Run the production build again before accepting the upgrade.

If a stage fails and you cannot resolve it, return source, manifest, and lockfile to the preceding checkpoint together. Reinstall from that lockfile and re-run its checks. Downgrading only @cratis/components leaves PrimeReact 11 imports and styles in place and is not a complete rollback.

Components 3 requires the application to supply PrimeReact as a peer dependency: a package it must resolve from the application rather than install as its own nested dependency. Components 2 declared primereact as a regular dependency, which could leave an application with separate PrimeReact copies and provider contexts. That can cause mismatched overlay ordering or provider settings.

The command below preserves the original install shape, not a current version selection. Before using it, replace the unversioned @cratis/components argument with @cratis/components@^3.0.0 and give each Prime package a range from your selected Components 3 manifest. The unversioned command can otherwise select a different major release.

Terminal window
npm install @cratis/components primereact @primereact/core @primereact/headless @primereact/hooks primeicons

The PrimeReact 11 peer shape at the pinned Components 3 reference is:

{
"dependencies": {
"primereact": "^11.0.0",
"@primereact/core": "^11.0.0",
"@primereact/headless": "^11.0.0",
"@primereact/hooks": "^11.0.0",
"primeicons": "^8.0.0"
}
}

Declare the required peers explicitly, including @primereact/core, @primereact/headless, and @primereact/hooks where the selected Components 3 manifest requires them. This matters with strict installers such as pnpm and Yarn PnP. Keep the PrimeReact packages on a mutually compatible release; do not copy an isolated patch version from this guide.

At the pinned reference, primeicons is on 8.x. @primereact/types is an optional peer, but published Components declarations reference its types; declare it if your type-checking setup cannot resolve them. @primereact/styles and @primeuix/themes are optional peers for PrimeReact styled mode. The baseline theme and unstyled mode do not need those two packages.

If you previously used resolutions or overrides to collapse PrimeReact copies, inspect the resolved dependency graph before removing the pin. A peer declaration alone does not prove that every direct or transitive consumer resolves to the same instance.

The Arc peer window changed across Components 3 patch and minor releases. Read peerDependencies from the Components 3 version selected by the application’s lockfile instead of treating this historical guide as an Arc compatibility matrix.

Keep @cratis/arc, @cratis/arc.react, and @cratis/arc.vite on mutually compatible versions, using the selected Arc manifests as well as Components’ peer ranges. A second Arc copy can produce a “types have separate declarations of a private property _connection” diagnostic when observable-query types cross package instances. Resolve the duplicate package boundary rather than casting away that error.

Components 3 separates CSS from JavaScript imports. This addresses the CSS-loading boundary reported in #118: Node-based tooling should not have to load component .css files when it imports a JavaScript subpath.

Import the stylesheet layers once in each application entry point that renders Components:

// in your app entry point
import '@cratis/components/tokens'; // the --cratis-* token layer
import '@cratis/components/styles'; // all component CSS, in one file
import '@cratis/components/theme'; // optional — the Cratis baseline look (MIT CSS)

Import them in that order. styles and theme both consume the tokens.

styles now contains component CSS as well as the compiled Tailwind utilities. It includes allotment/dist/style.css for DataPage split views, so remove a duplicate Allotment import if your entry point already has one.

Keep tokens: component CSS consumes its --cratis-* variables. Missing token values can leave cards, panels, and overlays without their intended colors and borders. Choose the optional theme or supply your own appearance as described below.

If custom CSS targeted SchemaEditor CSS Module hashes, move those selectors to cratis-schema-editor-navigable-row and cratis-schema-editor-bottom-border, the plain prefixed classes now included in styles.

PrimeReact 11 is ESM-only, so @cratis/components dropped its CommonJS build. main, module and every exports entry point at dist/esm, and the package declares "type": "module".

  • If your app bundles with Vite / modern tooling (the Cratis default), no change.
  • If something in your pipeline require()d the package, switch it to import.

Replace imports for removed PrimeReact 10 modules with the Components 3 equivalents below. Review direct PrimeReact controls separately; a renamed module does not necessarily preserve its old composition.

Was (PrimeReact 10) Now (3.0)
import { Column } from 'primereact/column' import { Column } from '@cratis/components/DataTables' (also re-exported from @cratis/components/DataPage)
import { StepperPanel } from 'primereact/stepperpanel' import { StepperPanel } from '@cratis/components/CommandDialog'
import { Menubar } from 'primereact/menubar' <DataPage.MenuItems> for list-page actions; a Button toolbar of your own otherwise
import { Dropdown } from 'primereact/dropdown' import { Dropdown } from '@cratis/components/Dropdown'
primereact/calendar, primereact/inputtextarea, primereact/multiselect, primereact/chips, primereact/colorpicker consume through the CommandForm fields (CalendarField, TextAreaField, MultiSelectField, ChipsField, ColorPickerField)
import { PrimeReactProvider } from 'primereact/api' import { PrimeReactProvider } from '@primereact/core' — or just use CratisComponentsProvider

<Column field="name" header="Name" sortable filter /> and <StepperPanel header="…"> work exactly as before.

If you import primereact/* directly anywhere

Section titled “If you import primereact/* directly anywhere”

Use the rename table and removed-with-no-replacement list in PrimeReact and Components. PrimeReact 11 controls are compositional: you assemble parts such as Select.Root, Select.Trigger, and Select.Popup rather than render one v10-shaped control. Prefer a Cratis wrapper where its API fits your requirements.

Where the library needed a removed module, it now owns a replacement: a Cratis action toolbar (for menubar, driven by the same model array shape and reached through <DataPage.MenuItems>), Column plus its filter menu (for column), StepperPanel (for stepperpanel), and MultiSelectField re-expressed over our own Dropdown wrapper (v11’s Select has no multiple prop of the v10 shape).

The removed DataTableSelectionSingleChangeEvent is replaced by DataTableSelectionChangeEvent<T>. event.value (the selected row) is unchanged, so only the type import moves:

import { DataTableSelectionSingleChangeEvent } from 'primereact/datatable';
onSelectionChange={(e: DataTableSelectionSingleChangeEvent<Product[]>) => setSelected(e.value as Product)}
import type { DataTableSelectionChangeEvent } from '@cratis/components/DataTables';
onSelectionChange={(e: DataTableSelectionChangeEvent<Product>) => setSelected(e.value ?? undefined)}

Per-column filter menus (<Column filter dataType="…" />), a global search box, and a paginator range report are all restored — no API change to opt in beyond filter.

PrimeReact 11 removes primereact/resources/themes/*.css. The primitives used by Components 3 render structural parts; styled mode adds both a preset, which supplies design-token values, and component styles, which apply those values to the controls. Passing only theme: { preset } is not enough to reproduce a styled control.

In Components 3, the --cratis-* token layer can read PrimeReact 11’s --p-* tokens and fall back to legacy PrimeReact 10 variables. Inspect the application after removing its old theme: remaining selectors or variables may still depend on that stylesheet.

Choose the path that matches who owns your application’s appearance. The pinned Styling pages describe the Components 3 configuration for each path.

For the Cratis baseline theme, import the Cratis-authored CSS for light and dark token values. It needs no Prime preset or styled-mode package, but using it does not remove the PrimeReact 11 license requirement.

import 'primereact/resources/themes/lara-dark-blue/theme.css';
import '@cratis/components/theme';

For PrimeReact styled mode, styledMode() from @cratis/components/styled returns { theme, defaults }: a preset plus primeReactStyles for primitives under the provider. Install compatible @primereact/styles and @primeuix/themes versions for this path. The helper accepts preset, darkModeSelector, and cssLayer; its defaults use CratisPreset, .cratis-dark, and a primereact cascade layer between Tailwind’s base and components layers. Unlayered product CSS takes precedence over that layer.

import 'primereact/resources/themes/lara-dark-blue/theme.css';
import { styledMode } from '@cratis/components/styled';
// …
<CratisComponentsProvider>
<CratisComponentsProvider value={{ license: '…', ...styledMode() }}>

Use npm i @primereact/styles @primeuix/themes only with version ranges matching the selected Components 3 peers, not unbounded current packages.

For an application-owned design, keep the structural stylesheet and --cratis-* token layer, then supply visuals through pt, CSS, or Tailwind:

<CratisComponentsProvider value={{ unstyled: true, pt: myPreset }}>

If your CSS was written against a v10 theme’s variables

Section titled “If your CSS was written against a v10 theme’s variables”

If your product CSS reads v10 variables such as --surface-card, --text-color, or --primary-color, removing the theme can leave those values undefined. Components 3’s @cratis/components/primereact-v10-palette supplies the legacy semantic names and color scales with Lara-blue fallbacks while you migrate the CSS:

import 'primereact/resources/themes/lara-dark-blue/theme.css';
import '@cratis/components/tokens';
import '@cratis/components/styles';
import '@cratis/components/primereact-v10-palette';
// …
<CratisComponentsProvider value={{ license: '…', ...styledMode() }}>

Semantic names read the preset’s --p-* values where an equivalent exists; numbered scales retain Lara-blue values. Light and dark values use light-dark() with .cratis-dark, the selector also used by the baseline theme and styledMode().

If canvas drawing code reads these custom properties, do not pass an unresolved light-dark(...) string to CanvasRenderingContext2D.fillStyle. Assign the color to an attached DOM element and read its computed color before passing the resolved value to the drawing API.

Import tokens, styles, then the palette and/or theme. Treat the palette as a bridge for existing CSS, not a new design contract. Use --cratis-* for new Components styling; use --p-* only where you intentionally depend on Prime styling.

CratisComponentsProvider takes everything through its single value prop, which is deep-merged onto PrimeReact’s provider config — unstyled, pt, ptOptions, ripple, inputVariant, zIndex, locale, theme, defaults and license. It also accepts a toaster prop (true or a ToasterProps object) to mount a <Toaster /> for you.

Dialog, CommandDialog, and StepperCommandDialog retain initialFocus (DialogInitialFocus.Confirm | Cancel | Content) using the v11 focus trap. Verify the chosen focus target in your application, especially with a custom footer.

Set dismissable explicitly if a custom footer should still offer header-close, backdrop, and Escape dismissal; by default those are offered for a predefined DialogButtons set but not a custom footer. Use closeAriaLabel to localize the header close button. Remove reliance on resizable: it remains accepted but the headless dialog has no resize handle.

StepperCommandDialog keeps showCancel / cancelLabel (the opt-in footer Cancel), and still withdraws every dismissal — footer Cancel, header close and Escape — for the whole window a command is executing in.

Overlay z-index workarounds are gone (and no longer needed)

Section titled “Overlay z-index workarounds are gone (and no longer needed)”

Remove calls to the old useOverlayZIndex hook, which Components 3 no longer exports. The v11 select portal and z-index registry replace Components 2’s wrapper workaround for a select opened inside a dialog.

Check that interaction in your application before removing any product-owned overlay logic. Code that used the hook for unrelated custom overlays still needs an application-owned solution; the Components migration does not configure those overlays.

Reduced capabilities (forced by PrimeReact 11)

Section titled “Reduced capabilities (forced by PrimeReact 11)”

Some props remain accepted for source compatibility but no longer provide their Components 2 behavior. Review each usage; a passing type check does not establish that the interaction survived:

Prop What changed
Dialog resizable v11’s headless dialog has no resize handle — no effect.
ChipsField separator v11 InputTags commits one tag per Enter; pasted input is no longer auto-split.
MultiSelectField display / maxSelectedLabels v11 Select renders the selection through its value slot; the v10 comma/chip modes and label-collapse are gone.
DataTableForQuery / DataTableForObservableQuery / DataPage clientFiltering Retained as a deprecated no-op for source compatibility. Filtering always affects only the loaded page and pagination retains server totals. For complete-result filtering, pass filters as query arguments and apply them on the server before paging.

Other wrappers expose a narrower API than their PrimeReact 10 counterparts:

  • Column keeps field, header, body, sortable, and filter; v10 props such as editor, frozen, footer, colSpan, and expander are not carried over.
  • Dropdown exposes its own single/multi-select props and pt / ptOptions / unstyled, not arbitrary PrimeReact Select props. It defaults optionLabel / optionValue to label / value when those fields exist on the option objects.
  • DataPage replaces the v10 Menubar with an action toolbar. menubarPt / menubarPtOptions / menubarUnstyled target its buttons; paginatorClassName and paginatorAriaLabels customize the paginator.
  • StepperCustomizationProps is Cratis-owned rather than an alias of PrimeReact’s StepperProps; removed renderer slots are not part of its shape.

If you write pt definitions or CSS selectors against PrimeReact internals

Section titled “If you write pt definitions or CSS selectors against PrimeReact internals”

Outside styled mode, target the v11 data attributes, such as [data-scope="dialog"][data-part="close"], rather than assuming v10 p-* classes exist. Styled mode supplies the Prime classes through component styles and puts the theme in the configured cascade layer. Check each custom selector against the rendered parts in the styling mode you selected.

What’s new (nothing to migrate — just available)

Section titled “What’s new (nothing to migrate — just available)”

These additions are optional; adopting them is not a prerequisite for the upgrade. Use the pinned references if you need them after the migration checks pass.

Need Components 3 reference
Show command feedback Notifications
Render status and identity Display
Add specialized command fields PasswordField, ToggleSwitchField, RatingField
Generate fields from command metadata AutoCommandForm
Configure appearance @cratis/components/theme or @cratis/components/styled

@cratis/components/primereact-v10-palette is the temporary variable bridge described above. Dropdown’s label / value defaults preserve the common v10 option shape; neither requires adopting another component.

Components 3 introduces a PrimeUI license boundary through PrimeReact 11. Do not carry a PrimeReact 10 licensing assumption into this upgrade. Review the terms for the exact Prime packages you install, including any icon and styled-mode packages.

@cratis/components is MIT-licensed at the pinned Components 3 reference. That license does not replace the terms of its peers or other dependencies; assess them separately for your application.

A key is required regardless of how you style

Section titled “A key is required regardless of how you style”

Choosing unstyled rendering or the Cratis baseline theme does not bypass the PrimeReact provider. The pinned Components 3 provider passes the license through to PrimeReact 11 and documents its “Invalid PrimeUI License” warning and banner when a valid key is missing, in development and production. Supply the key through the provider’s value:

<CratisComponentsProvider value={{ license: '…' }}>

Styled mode additionally uses @primereact/styles and @primeuix/themes. The Cratis baseline theme avoids those styling packages, not PrimeReact itself.

For Storybook or a Vite-based tool, the historical setup uses PRIMEUI_LICENSE. A plain environment variable is not automatically available through import.meta.env; relay it explicitly in the tool configuration, for example with define: { 'import.meta.env.PRIMEUI_LICENSE': JSON.stringify(process.env.PRIMEUI_LICENSE) }, then pass it to the provider. The pinned Source/.storybook/main.ts shows that relay.

Check the current Community License eligibility terms or the Commercial License terms with PrimeTek. This historical guide is not an authority for current eligibility thresholds, pricing, or renewal conditions.

If you publish a component library or development tool rather than an application, review the redistribution and OEM terms with PrimeTek before adopting the Prime packages. Do not assume that permission to build an application also covers distributing a library for others to build with.

Components 2 used PrimeReact 10 rather than introducing the PrimeReact 11 boundary described here. That is a historical dependency distinction, not a claim that every package in a Components 2 application is MIT-licensed or that it has current support commitments.

Components 4 removes PrimeReact from Core; optional Prime renderer adapters and direct Prime imports still bring their own requirements. If you want to remove the Components 3 Prime dependency, use the 3.x → 4.0 guide and review any retained Prime usage before removing its license configuration.

This is not legal advice. Read the LICENSE.md in the exact primereact package you select, PrimeReact’s own migration guide, and the license pages above. Once the Components 3 checks pass, keep the resulting source and lockfile as your upgrade checkpoint; treat a later move to Components 4 as a separate migration.