Skip to content

Conversation

@shahabl
Copy link

@shahabl shahabl commented Jan 16, 2026

Description

This PR adds support for custom elements when using the <a2ui-surface> component by exposing the enableCustomElements property.

Problem

The A2UI Root component has an enableCustomElements property that allows custom elements registered via componentRegistry to be rendered. However, the Surface component (which wraps Root) did not expose this property. This meant that when using <a2ui-surface> as the top-level component, it was impossible to enable custom element rendering.

Solution

  • Added enableCustomElements property declaration to the Surface component
  • Propagated the property from Surface to the Root component in the render template

This is a minimal, non-breaking change that enables the existing custom element functionality to work through the Surface component.

Use Case

Applications using <a2ui-surface> can now register and render custom components alongside standard A2UI components by setting:

surfaceElement.enableCustomElements = true;

Pre-launch Checklist

If you need help, consider asking for advice on the discussion board.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly adds the enableCustomElements property to the Surface component and passes it to the underlying Root component, enabling custom element rendering when using <a2ui-surface>. The change is minimal and effective. My review focuses on improving project quality by adding tests and documentation for this new feature, as per the repository guidelines. I've also noted from the PR checklist that the changelog should be updated.

Comment on lines +35 to +36
@property({ type: Boolean })
accessor enableCustomElements = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This new property enables key functionality for the Surface component. Based on the repository's style guide (line 17), new code changes should include tests. Please add a unit test to verify that custom elements are correctly rendered when enableCustomElements is set to true on an <a2ui-surface> component.

References
  1. If there are code changes, code should have tests. (link)

Copy link
Author

Choose a reason for hiding this comment

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

The existing test suite (model.test.ts) focuses on the data processing layer and
doesn't include UI component rendering tests. UI component tests would require browser
globals (DOM, CustomEvent, HTMLElement, etc.) and a test environment setup (like
jsdom or happy-dom).

Shahab Layeghi added 2 commits January 16, 2026 14:32
Add enableCustomElements property to Surface component and propagate it to
Root component. This allows custom elements registered via componentRegistry
to be rendered when using a2ui-surface.

Previously, the Root component supported custom elements via the
enableCustomElements property, but Surface did not expose this property,
making it impossible to enable custom elements when using Surface as the
top-level component.
- Update custom-components.md guide with usage instructions
- Include code example showing how to enable custom elements on Surface

Note: UI component tests require browser globals (DOM, CustomEvent, etc.)
which would need a test environment like happy-dom or jsdom. The existing
test suite only tests the data processing layer. The 4-line code change
can be verified by code review.
@shahabl shahabl force-pushed the fix/surface-enable-custom-elements branch from 3b36271 to e3357c6 Compare January 16, 2026 22:32
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.

1 participant