diff --git a/docs/knowledge-base/BringYourOwnWebComponents.mdx b/docs/knowledge-base/BringYourOwnWebComponents.mdx new file mode 100644 index 00000000000..f5cb02e5987 --- /dev/null +++ b/docs/knowledge-base/BringYourOwnWebComponents.mdx @@ -0,0 +1,71 @@ +import { Footer, TableOfContent } from '@sb/components'; +import { Meta } from '@storybook/blocks'; +import { Link, MessageStrip } from '@ui5/webcomponents-react'; + + + +# Bring Your Own Web Components + + + +If you have created a custom UI5 Web Components package, you will be able to create React component wrappers in your project by leveraging our [@ui5/webcomponents-react-cli](http://npmjs.com/package/@ui5/webcomponents-react-cli). + + + The UI5 Web Components for React CLI package is tailor-made for custom UI5 Web Components packages following{' '} + this documentation.
+ You can not use it for creating React wrapper for arbitrary custom element libraries. + + } +/> + +
+
+ +## Create React Wrappers + +> This guide uses the name `my-custom-webcomponents-package` for the custom UI5 Web Components package.
+> Please replace all occurrences with your real package name when following this guide. + +First of all, install the `@ui5/webcomponents-react-cli` package in your project: + +```shell +npm install @ui5/webcomponents-react-cli --save-dev + +# if your package is based on UI5 Web Components V1, please install the V1 version of the CLI +npm install @ui5/webcomponents-react-cli@V1 --save-dev +``` + +Then, install your custom UI5 Web Components package: + +```shell +npm install my-custom-webcomponents-package --save +``` + +Now, you can add a npm script to create your wrapper components.
+_We recommend ensuring that the target directory (specified by the `--out` parameter) is empty._ + + + The UI5 Web Component for React CLI is not aware of any code style conventions you may be using in your project, so we recommend that you run tools such as prettier and{' '} + eslint after creating the wrapper components if you are using them in your project. + + } +/> + +```json +{ + "//": "rest of your applications package.json", + "scripts": { + "//": "your other scripts", + "create-webcomponent-wrappers": "ui5-wcr create-wrappers --packageName my-custom-webcomponents-package --out ./any/directory/in/your/project" + } +} +``` + +