Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Dismissable alerts #158
This PR adds a
I have also taken the opportunity to improve the alert documentation, and add some more detailed examples.
I just noticed that 'dismissable' only works if you give the alert an id. Seems like an unnecessary burden to have to give an id to an Alert that will never get used on the server. Only needed to hide it on the client, right?
Just for future reference and those who are really lazy (not me of course!), I wonder, is this a quirk about Dash not being able to propagate events to id-less components?
Anyway, maybe just a mention in the docs will help the next person, too. Anyway, awesome update! :)
Thanks a lot for raising this. I haven't been able to reproduce it though. This is the test app I ran:
import dash import dash_bootstrap_components as dbc app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP]) app.layout = dbc.Alert("This is an alert", dismissable=True) if __name__ == "__main__": app.run_server(debug=True, port=8888)
The Alert dismissed as I would have expected when clicking on the dismiss button. These are the versions of Dash libraries I was using:
Could you share an example where you see the behaviour you describe?
Yes, exact same versions, but I am still seeing the same problem.
The only difference with my test is this line. Change:
IE, add a Div wrapper or even a dbc.Card, etc. If I add an id to Alert, it works, tho.