The id parameter of Dash components
As briefly mentioned in Chapter 1, Overview of the Dash Ecosystem, every Dash component has an id
parameter that you can easily set in order to uniquely identify it. There is actually nothing more to this parameter than making sure that your components have unique and descriptive names.
Note
There are more advanced ways of using the id parameter, and they will be tackled in a later, more advanced chapter. However, for now, we will just focus on it being a unique identifier.
Using descriptive and explicit names for the id
parameter becomes more important as the app grows in complexity. This parameter is optional when there is no interactivity, but it becomes mandatory when there is. The following example snippet shows how easy it is to set the id
parameter for a basic use case:
html.Div([ Â Â Â Â html.Div(id='empty_space'), Â Â Â Â html.H2(id='h2_text'), Â Â Â Â dcc.Slider...