Create custom component that fires events in pure Python

I’m trying to create a custom component that is basically a list of buttons. When you click one of those buttons, I want the component to trigger all callbacks for the component, with the value of the button that was pressed. It’s supposed to work a bit like a component.

Ideally, this would be used like:

import dash_core_components as dcc
import dash_html_components as html
from my_button_component import ButtonComponent

app.layout = html.Div([
    ButtonComponent(id='my-component'),
    dcc.Graph(id=graph)
])
@app.callback(
    Output('graph', 'figure'),
    [Input('my-component', 'selected_button')], 
)
def callback(button):
    # Generate some plot using the selection
    pass

The key thing I want to do here is have a callback that listens for ‘selected_button’, which is a custom event my component should fire. However, since this component is currently pure Python, I’m not sure how to get it to create this event. Is this possible?

Hi @Migwell, I’m interested in doing the same thing, did you get anywhere with it? Thanks