Skip to main content
Frontend tutorial

8.2. Add an icon and a design

Now let's customize the button: add an icon and a design.

design="Emphasized" makes Load pallet the main action on the screen. The icon needs one more step: UI5 icons live in their own package, and you import each one before icon="add" can find it. While you're here, add a Reset button with the refresh icon. It needs its own import too.

import { Button } from '@ui5/webcomponents-react/Button';
import '@ui5/webcomponents-icons/dist/add.js';
import '@ui5/webcomponents-icons/dist/refresh.js';
import './styles.css';
<p>{loaded} / 10 pallets loaded</p>
<Button
icon="add"
design="Emphasized"
onClick={() => setLoaded(loaded + 1)}
>
Load pallet
</Button>
<Button icon="refresh" onClick={() => setLoaded(0)}>
Reset
</Button>
Need a hint?
  • No icon? Check its import: icon="add" alone isn't enough.
  • Each icon has its own file, so refresh needs its own import.

Load pallet turns SAP blue. Pick another icon from the icon list, or try design="Transparent" on Reset.

Work locally

You need Node.js 24, pnpm and Git (how to set them up). Clone this step’s starting code:

git clone --depth 1 \
--branch lesson-08-02-icon-and-design-start-v6 \
https://github.com/adam-zielonka/frontend-tutorial.git \
08-02-icon-and-design
cd 08-02-icon-and-design
pnpm install --frozen-lockfile
pnpm dev

To keep your own commits: git switch -c my-work.

Browse the source on GitHub (opens in a new tab)

Bring your browser edits

Choose Download my files in the ⋯ menu. It saves the lesson’s files as JSON. Stop the local server with Ctrl+C, copy the download into the project folder and run:

node import-draft.mjs ./08-02-icon-and-design-my-files.json
pnpm dev

The import replaces the project’s exercise files, so commit or back up local edits first.

Loading this step’s code…
Starting the live preview…