1. Learn
  2. /
  3. Courses
  4. /
  5. Building Dashboards with Dash and Plotly

Connected

Exercise

Re-using Dash components

Your Dashboards are gaining traction, especially your recent date picker app. A senior manager loved it but requested some updates: use the corporately styled logo and display it in multiple places.

To keep your code clean, it's time to create a reusable Python function for the logo.

The approved logo style is: 'width':'75px', 'margin':'20px 20px 5px 5px', 'border':'1px dashed lightblue', 'display':'inline-block'

Instructions

100 XP
  • Create a reusable component function called add_logo() below line 11 to return the corp_logo component.
  • Inside this function, create a Dash image element called corp_logo using the appropriate HTML component with the provided style below line 13.
  • Call the add_logo() function in each of the 4 marked spots below lines 20, 27, 30, and 46.