Open dwipper opened 1 month ago
Hi @dwipper there is a Gradio custom component gradio_modal
that is quite popular and does exactly this:
a gr.Modal component that could display one or more components, i.e. gr.Dropdown, gr.Textbox, gr.Radio, etc. Being able pass the gr.Model a full gr.Blocks layout would be really great.
See here on how to use in your gradio app: https://huggingface.co/spaces/aliabid94/gradio_modal
I do think its a good idea to bring this into core though, so tagging @aliabid94
@abidlabs @aliabid94 Thanks! That works great! I played around with it a bit. Since it appears to close on mouse-click outside the modal and escape in addition to the "X", it would be helpful to have a param that optionally pops up a "Are you sure you want to close" type message. While the standard modal uses the full viewport, I tried a bunch of CSS mods to come up with more of a confirmation style modal. Without specifying specific pixels sizes (which can be problematic) the modals looked pretty wonky. Wondering if there could be a param that either goes 100% or shrinks to fit the layout/components?
Here's is a modal over modal. Doesn't work so great:
Is your feature request related to a problem? Please describe.
Except for the gr.Info, gr.Error, gr.Warning components, there is no native ability to pop open a modal window to gather user input, i.e. "Continue Yes/No", "Submit - Are you sure?", "Delete record - Are you sure?"
Describe the solution you'd like
While a simple solution would be to have a "gr.Confirm" component that would have hardwired Yes/No buttons, a cooler solution would be to have a gr.Modal component that could display one or more components, i.e. gr.Dropdown, gr.Textbox, gr.Radio, etc. Being able pass the gr.Model a full gr.Blocks layout would be really great.
Additional context
Add any other context or screenshots about the feature request here.