Skip to main content
Frontend tutorial

8.4. More exercises

There is much more in the library than buttons. Pick a component and add it to your loading screen:

In your own projectโ€‹

Create a project as in 3.2 and add the UI5 packages:

pnpm create vite my-ui5-app --template react-ts
cd my-ui5-app
pnpm add @ui5/webcomponents @ui5/webcomponents-react \
@ui5/webcomponents-fiori @ui5/webcomponents-icons
pnpm dev

In src/main.tsx, wrap App with ThemeProvider, once for the whole app, and remove the template's import './index.css': the styles from 8.3 replace it.

src/main.tsx
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { ThemeProvider } from '@ui5/webcomponents-react/ThemeProvider'
import App from './App.tsx'

createRoot(document.getElementById('root')!).render(
<StrictMode>
<ThemeProvider>
<App />
</ThemeProvider>
</StrictMode>,
)

Then copy App.tsx and styles.css from 8.3 into src/, and drop the ThemeProvider from App: main.tsx has it now.

08 / UI5 Web Components for React

localhost:5173
The loading screen from this chapter running locally: the heading Shipment loading, 6 / 10 pallets loaded, a progress bar at 60%, a blue Load pallet button with a plus icon and a Reset button with a refresh icon.

The loading screen from this chapter, running with pnpm dev.