-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
What is the proper way to Override text color of list elements in the gradio.Dropdown
component?
#4988
Comments
Hi @x-CK-x if you are trying to style a specific In your case, you could do something like this: import gradio as gr
css = """
.required-dropdown li{
color: red
}
"""
with gr.Blocks(css=css) as demo:
gr.Dropdown(label="Regular Dropdown", choices=["America", "Azerbaijan", "Bahrain"])
gr.Dropdown(label="Required Dropdown", choices=["America", "Azerbaijan", "Bahrain"], elem_classes=["required-dropdown"])
demo.launch() which produces this: |
Hi @abidlabs and thank you so much for getting back to me on this matter! My application of this is having a set number of colors pertaining to different categories to which the tags presented in the dropdown menu would show as the respective category color. |
Not possible as far as I can tell, unless you can think of some css selector queries to accomplish it. I'd say that's outside the scope of the We are working on custom components which should make it possible for users to create extensions to existing components for this kind of thing. |
Hi @abidlabs, does the dropdown support changing the color of elements after they've been selected by a user? If not, can we achieve this with js and if so how? Thanks! |
@x-CK-x @abidlabs This may achieved by the following:
|
Describe the bug
using the _js event listener option, I was unable to set the color of text in the
elem_id="required_dropdown" for the specified dropdown menu and then for the event listener option _js I used the following:
Have you searched existing issues? 🔎
Reproduction
firstly, set the
elem_id="required_dropdown" for the specified dropdown menu and then for the event listener option _js I used the following:
Screenshot
No response
Logs
No response
System Info
Severity
Blocking usage of gradio
The text was updated successfully, but these errors were encountered: