Programatically list component ids in current layout

Is there a way to list (within a callback) all the currently available ids in the app layout? For example if my app has three divs and all have ids getting a list with the three values.

A very simple way to do this is wrap everything you need in a div, and give it an id: html.Div(id="stuff"). Then just put it into whatever callback you want as state: State("stuff", "children"). The result will look something like this (here, a dcc.Dropdown within an html.Td):

image

And then you can access whatever you want, e.g.: div["props"]["children"]["props"]["value"].

There are other ways to do this, but I’m not too sure since it’s been some time. I think it was something along these lines (one or more of them, all are worth looking into), on the app object (app = dash.Dash):

  • app.callback_map
  • app.layout
  • app._layout
  • app.__dict__
2 Likes

Thanks! This is exactly what I needed.