Skip to content

docs: mention scoping in FAQ and Migration Guide #7439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/MigrationGuide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ For a complete list of breaking changes in UI5 Web Components, please refer to t

_**Note:** Our `codemod` covers changes from ui5-webcomponents as well._

_**Note:** Setting the scoping suffix should be done before importing any components, as they use the suffix at the top-level of the module - meaning when a component is imported, the suffix has to be known.
For this to work, calling the method should be done in a separate module (e.g. scoping-config.js) and this module should be imported before any components are imported._

## Codemod

To make the migration to UI5 Web Components (for React) v2 easier,
Expand Down
19 changes: 19 additions & 0 deletions docs/knowledge-base/FAQ.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,23 @@ Each component developed by the UI5 Web Components team ([`ui5-webcomponents`](h

If a component does not have this note, it is a React-only component provided exclusively by `ui5-webcomponents-react`.

## Scoping

Starting from UI5 Web Components (for React) 2.0.0, the order if imports with regards to scoping and components matters.
Setting the scoping suffix must be done before importing any components, as they use the suffix at the top-level of the module - meaning when a component is imported, the suffix has to be known.
For this to work, calling the method should be done in a separate module (e.g. scoping-config.js) and this module should be imported before any components are imported.
You can find more information about this in the [UI5 Web Components documentation](https://sap.github.io/ui5-webcomponents/docs/advanced/scoping/).

```ts
// scoping-config.js
import { setCustomElementsScopingSuffix } from '@ui5/webcomponents-base/dist/CustomElementsScope.js';
setCustomElementsScopingSuffix('demo');

// app main file, e.g index.js, main.tsx, etc.
import './scoping-config.js';
// now, all other component imports - the scoping config import must be the first import of the app
import { Button } from '@ui5/webcomponents-react';
// ...
```

<Footer />
Loading