Skip to content

[6.x] Export panels, action menus and UI modals from @craftcms/cp - #20570

Merged
brandonkelly merged 8 commits into
6.xfrom
feature/6x-order-edit-port
Nov 10, 2026
Merged

brandonkelly merged 8 commits into
6.xfrom
feature/6x-order-edit-port

Conversation

@nfourtythree

Copy link
Copy Markdown
Contributor

Description

Plugin pages that build their own screens can import components and composables from @craftcms/cp, but a handful of pieces core already uses for its own screens weren't exported. Commerce's new order edit screen needs them, and without the exports a plugin has to copy them or reach into core's source.

This exports them from cp-module.ts:

  • ScreenPanel, to add a panel to a screen's details column
  • MetadataDetails, the details column's Info panel
  • ActivityTimeline, an element's activity and comments
  • ElementActionMenu, an element's actions from its actionMenuDescriptors()
  • openUiModal() and UiModalOptions, to open a server-defined UI form in a dialog

ScreenPanel's default slot also receives an active prop now, true while its panel is open. A panel can use it to load its content only once someone opens it, which the activity timeline needs. Existing uses of ScreenPanel don't pass anything to the slot, so they're unaffected.

Related issues

craftcms/commerce#4443

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

📚 Storybook previews

@craftcms/ui — open Storybook

No changed components detected in this Storybook.

resources/js — open Storybook

No changed components detected in this Storybook.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the expanded control-panel API and panel slot update.

No open issues 🎉

What changed in this PR

Expands @craftcms/cp so plugin-built screens, including Commerce’s new order editor, can reuse core control-panel features without copying code or importing internal source files.

Changes:

  • Exports panel, metadata, activity, action-menu, HTML-rendering, and UI-modal utilities with related types.
  • Adds a typed active slot prop to ScreenPanel, enabling content to load when its panel opens.
  • Documents the public exports and slot addition in the changelog.
File Description
resources/​js/​cp-module.ts Exposes additional components, UI helpers, and types to plugins.
resources/​js/​common/​components/​ScreenPanel.vue Passes the panel’s open state to its default slot.
CHANGELOG-WIP.md Documents the expanded plugin API and active slot prop.

Review effort: Balanced

@brianjhanson brianjhanson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm torn on if we should just export everything for plugin authors. On the one hand, I'm sure that would be useful. On the other hand, I'm sure that would be somewhat "dangerous" at least from a perspective of what we're on the hook to support down the line.

@nfourtythree
nfourtythree marked this pull request as ready for review November 10, 2026 15:47
@nfourtythree

Copy link
Copy Markdown
Contributor Author

@brianjhanson yea, probably a month or so ago I think I had something in one of the PRs that exposed everything but had exactly this thought.

It is a bit of a catch 22 because not sure what you need until you don't have it at your disposal.

@brandonkelly
brandonkelly merged commit fb8ad25 into 6.x Nov 10, 2026
22 checks passed
@brandonkelly
brandonkelly deleted the feature/6x-order-edit-port branch November 10, 2026 17:49

Copy link
Copy Markdown
Contributor

Opened #20608 which exposes a whole lot more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants