Customizing the Issue Panel by adding UI Kit elements
Now that we have our app template, let’s start getting familiar with different UI elements by updating our app.
There are two common routes when building your Forge UI: UI Kit and Custom UI. In this exercise, we will use UI Kit components to add UI elements to our app.
Updating the project
-
In your preferred IDE, open the frontend file to update:
src/frontend/index.jsx -
In the App component, delete the existing Text components as we will not be using them. Be careful not to delete too much as we’ll be needing the closing tags and brackets.
return ( <> {/* Delete the lines below */} {/* <Text>Hello world!</Text> */} {/* <Text>{data ? data : 'Loading...'}</Text> */} </> ); -
Add a title to text to our app by including Heading to the imports and updating the return statement to use the
Headingcomponentimport ForgeReconciler, { Text, Heading } from '@forge/react'; ... return ( <> <Heading size='medium'>Welcome, InsertDogBreedHere!</Heading> </> ); -
Deploy the changes first
-
Ensure that you are in your project directory and run the Forge deployment command
forge deploy -
For this exercise let’s use the tunnel to make the UI development experience much better
forge tunnel
-
-
Once the tunnel is running, add the information we want to display like temperature and humidity. Use the Text component to add this information.
-
Update the return statement by adding the
Textcomponents to display the informationreturn ( <> <Heading size='medium'>Welcome, InsertDogBreedHere!</Heading> <Text>Height: </Text> <Text>Weight: </Text> </> ); -
Once the edits are done, save the file and do not do a deployment. Go back to your browser, refresh the work item view, and notice that the UI changes are already reflected in the UI. (Thank you Forge tunnel!)
-
Add another
Textcomponent to show “Life expectancy” then save the file againreturn ( <> <Heading size='medium'>Welcome, InsertDogBreedHere!</Heading> <Text>Life expectancy: </Text> <Text>Height: </Text> <Text>Weight: </Text> </> );
-