-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Documentation for container component (#3412)
* Documentation for container component * Apply suggestions --------- Co-authored-by: Ndricim Rrapi <[email protected]> Co-authored-by: Johannes Doberer <[email protected]> Co-authored-by: Philipp Pracht <[email protected]>
- Loading branch information
1 parent
ca0bd59
commit f56cea6
Showing
3 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<!-- meta | ||
{ | ||
"node": { | ||
"label": "Luigi Container", | ||
"category": { | ||
"label": "Advanced", | ||
"collapsible": true | ||
}, | ||
"metaData": { | ||
"categoryPosition": 7, | ||
"position": 3 | ||
} | ||
} | ||
} | ||
meta --> | ||
|
||
# Luigi Container | ||
|
||
## Overview | ||
|
||
Luigi Container is a [web component](https://developer.mozilla.org/en-US/docs/Web/Web_Components) which can be used to render a Luigi micro frontend without the need of a Luigi Core application. Luigi container can work with any framework that supports HTML. It can be an easy solution for integrating micro frontends inside already existing apps without the cost of refactoring. The scenario of [multiple](#compound-container) micro frontends on the same page is also supported. | ||
|
||
## Installation | ||
|
||
1. Install the Luigi container [npm](https://www.npmjs.com/) package: `@luigi-project/container` | ||
|
||
```bash | ||
npm install @luigi-project/container | ||
``` | ||
|
||
2. Import it into your project: | ||
|
||
``` | ||
import '@luigi-project/container'; | ||
``` | ||
|
||
## Usage | ||
|
||
After importing the package, you can use the Luigi container anywhere in your application. You can configure it just like a regular Luigi application, for example by using [parameters](navigation-parameters-reference.md) such as [viewURL](navigation-parameters-reference.md#viewurl) (which specifies the URL of the micro frontend): | ||
|
||
```html | ||
<luigi-container | ||
viewURL="https://www.example-microfronted.com" | ||
webcomponent="false" | ||
label="my label" | ||
context='{"label": "Calendar"}'> | ||
</luigi-container> | ||
``` | ||
|
||
### Compound container | ||
|
||
The Luigi compound container works similarly to Luigi's compound web components [feature](web-component.md#compound-web-components) and it allows you to insert multiple micro frontends on the same page. | ||
|
||
You can use the Luigi compound container as follows: | ||
|
||
```html | ||
<luigi-compound-container | ||
context='{"label": "Dashboard"}' | ||
compoundConfig = { your config here }> | ||
</luigi-compound-container> | ||
``` | ||
|
||
## Example | ||
|
||
1. You can find a Luigi Container example on [GitHub](https://github.com/SAP/luigi/tree/main/container). First, clone the Luigi repository if you haven't already done so: | ||
|
||
```bash | ||
git clone [email protected]:SAP/luigi.git | ||
cd luigi/container | ||
``` | ||
|
||
2. Then, build the bundle and start the example app: | ||
|
||
```bash | ||
npm install | ||
npm run build | ||
npm start | ||
``` | ||
|
||
The app should be available at `http://localhost:8080` in your browser. | ||
|
||
3. Check `./test-app/index.html` to see how Luigi Container is used. | ||
|
||
|
||
<!--- TODO: Add OpenUI5 tutorial, on SAP developers website ----> |