-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buttons do not render in html #2520
Comments
Indeed that is the case, thank you for creating the issue @ValentinKoch! |
I can't reproduce so I will close this out! Feel free to re-open if I'm misunderstanding @ValentinKoch ! import gradio as gr
with gr.Blocks() as demo:
subject = gr.HTML(value="""<button type="button" onclick="alert('Hello world!')">Click Me!</button>""")
demo.launch() |
Hi @freddyaboulton , the Button is clickable but the design is not rendering. A Button looks usually like this: https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_button_test |
Reopened! Thanks @ValentinKoch |
@freddyaboulton: this may be out of scope, but may I ask these two questions as this ticket is nearest in scope?
|
This is happening because we 'reset' styles for easier styling later. I don't of a great solution to this unless we move all of our resets inline. We can fix the button but there will be other similar issues with different elements. I'm not convinced this is a bug, if users are going to write custom HTML and embed it into a page, I don't think it is unreasonable for them to write some custom CSS either. We make no guarantees about custom HTML + CSS. |
For me this issue does not longer persist as the workaround i was using for is no longer needed as you fixed the large file freeze issue :) Still curious what you mean by custom CSS, how would I get this Button to render? I could not make it even with inline style commands.. but im also not an expert |
Hi @ValentinKoch very late response, but the reason the CSS isn't working is because you might be targeting via class names. If you are going to use class named, you'd have to put html = """
<style>
.btn {
border: 1px solid gray;
background-color: #eee !important;
border-radius: 10px !important;
padding: 10px !important;
cursor: pointer;
display: inline-block;
}
/* On mouse-over */
.btn:hover {background: #ddd !important;}
</style>
<button class="btn">Click me</button>
"""
with gr.Blocks() as demo:
gr.HTML(html)
demo.launch() |
Hello, It doesn't work for me too. I have tried for radio buttons, and it shows all white color, while selecting one of the option.
Got this |
Describe the bug
Buttons dont render in HTML. Are clickable but do not look as intended, also when providing a dedicated css.
Is there an existing issue for this?
Reproduction
Screenshot
Logs
System Info
Severity
annoying
The text was updated successfully, but these errors were encountered: