ui5-webcomponents-react
is providing a Fiori-compliant React implementation by leveraging the UI5 Web Components.
This project was formerly known as fiori-for-react
.
You can find our documentation under the following links:
-
@ui5/webcomponents-react - Fiori 3 Components
-
@ui5/webcomponents-react-charts - Fiori Charts
-
@ui5/webcomponents-react-base - Utils
-
@ui5/cra-template-webcomponents-react - Template for
create-react-app
-
@ui5/cra-template-webcomponents-react-seed - Seed for
create-react-app
To consume ui5-webcomponents-react
, first you need to install the npm module:
npm install @ui5/webcomponents-react --save
Required peer dependencies:
npm install @ui5/webcomponents @ui5/webcomponents-fiori --save
You are new to UI5 Web Components for React and don't know where to start?
Then take a look at our Tutorial Mission at “SAP Developers”!
There you get a first glimpse at how easy it is to create an Application with UI5 Web Components for React.
In about an hour you will create a business dashboard from scratch and get familiar with some React basics in case you don't know them already.
You can create a new react app by using create-react-app with our template.
This template is installing all required dependencies for you and is setting up the App.js
file for you:
npx create-react-app my-app --template @ui5/webcomponents-react
# or if you want to use yarn
yarn create react-app my-app --template @ui5/webcomponents-react
You can create a new react app by using create-react-app based on our seed. This template delivers several out of the box components, scripts and configurations. For more info, check the seed documentation.
npx create-react-app my-app --template @ui5/webcomponents-react-seed
npm run start
# or if you want to use yarn
yarn create react-app my-app --template @ui5/webcomponents-react-seed
yarn start
First of all, you need to add the @ui5/webcomponents-react
dependency to your project. Please also keep in mind installing the required peer dependencies:
npm install @ui5/webcomponents @ui5/webcomponents-react @ui5/webcomponents-fiori --save
In order to use @ui5/webcomponents-react
you have to wrap your application's root component into the ThemeProvider
.
You will find this component most likely in src/App.js
:
import { ThemeProvider } from '@ui5/webcomponents-react';
...
render() {
return (
<div>
<ThemeProvider>
<MyApp />
</ThemeProvider>
</div>
);
}
Then you are ready to use @ui5/webcomponents-react
and you can import the desired component(s) in your app:
For example, to use the Button
component you need to import it:
import { Button } from '@ui5/webcomponents-react'; // loads ui5-button wrapped in a ui5-webcomponents-react component
Then, you can use the Button in your app:
<Button onClick={() => alert('Hello World!')}>Hello world!</Button>
You can also import all components from @ui5/webcomponents-react
directly.
For Browser Support and the configuration of the UI5 Web Components, please take a look at the Browser Support and the Configure sections of the UI5 Web Components Readme.
UI5 Web Components are supported by all major modern browsers, including their mobile versions.
Please look at our GitHub Issues.
We welcome all comments, suggestions, questions, and bug reports. Feel free to open issues or chat with us directly in the #webcomponents-react
channel in the
OpenUI5 Community Slack.
Please note that you have to join this Slack workspace via this link if you are not part of it already.
Please check our Contribution Guidelines.