Skip to content
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

Adds a "huggingface" button variant, and makes it the default for gr.LoginButton and gr.DuplicateButton #9254

Merged
merged 9 commits into from
Sep 3, 2024

Conversation

abidlabs
Copy link
Member

@abidlabs abidlabs commented Sep 3, 2024

For more consistency with HF Hub branding, this PR adds a "huggingface" button variant, and makes it the default for gr.LoginButton

Here are the "primary", "secondary", and "clear" variants:

image image

Compare with HF Hub branding: https://huggingface.co/docs/hub/en/oauth#branding

image

Closes: #5628

wdyt @hannahblair @Wauplin @gary149 @julien-c

@abidlabs abidlabs changed the base branch from main to 5.0-dev September 3, 2024 13:57
@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Sep 3, 2024

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website failed! Details
Storybook ready! Storybook preview
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-pypi-previews.s3.amazonaws.com/c236e82e823ac4316532e69bd1994048d9225301/gradio-4.42.0-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@c236e82e823ac4316532e69bd1994048d9225301#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/c236e82e823ac4316532e69bd1994048d9225301/gradio-client-1.5.1.tgz

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Sep 3, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/button minor
gradio minor
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Adds a "huggingface" button variant, and makes it the default for gr.LoginButton and gr.DuplicateButton

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@abidlabs abidlabs changed the title Adds a "clear" button variant, and makes it the default for gr.LoginButton Adds a "clear" button variant, and makes it the default for gr.LoginButton and gr.DuplicateButton Sep 3, 2024
@abidlabs
Copy link
Member Author

abidlabs commented Sep 3, 2024

Note that the original issue suggested dark buttons on a light theme and vice versa but that is jarring, especially in dark mode (and imo defeats the point of a light/dark setting) so instead, I've gone with light-on-light and dark-on-dark.

@abidlabs
Copy link
Member Author

abidlabs commented Sep 3, 2024

Also I've opted not to change the border radius, as that would break the ability of the button to be grouped with other components, e.g.

with gr.Group():
  gr.Textbox()
  gr.LoginButton()

or

with gr.Group():
  gr.DuplicateButton()
  gr.LoginButton()

@Wauplin
Copy link
Contributor

Wauplin commented Sep 3, 2024

For reference for other reviewers, here is the current style

image

image

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for handling this @abidlabs! I like your changes which looks much closer to the "official" branding :)

Instead of "clear" I would maybe renamed it "huggingface" to emphasize it's HF branding. The advantage of doing so is been able to update the style in the future if we want (compared to "clear" which can only mean "no-background"). For example for more rounded border or to have a different font.

@julien-c
Copy link
Contributor

julien-c commented Sep 3, 2024

maybe we could add a rounded=True option?

@abidlabs
Copy link
Member Author

abidlabs commented Sep 3, 2024

maybe we could add a rounded=True option?

@julien-c I'm a little hesitant with rounded borders because they look inconsistent with other buttons (or other components) generally in the Gradio app which all have a very small border radius, and it wouldn't play well with gr.Group, which groups together different components (e.g. if you want to stick a textbox next to a button, its much nicer if they have less rounded borders:

import gradio as gr

with gr.Blocks() as demo:
    with gr.Group():
        with gr.Row():
          gr.Textbox(show_label=False, scale=2)
          gr.LoginButton()

demo.launch()
image

Instead of "clear" I would maybe renamed it "huggingface" to emphasize it's HF branding. The advantage of doing so is been able to update the style in the future if we want (compared to "clear" which can only mean "no-background"). For example for more rounded border or to have a different font.

👍

@abidlabs abidlabs changed the title Adds a "clear" button variant, and makes it the default for gr.LoginButton and gr.DuplicateButton Adds a "huggingface" button variant, and makes it the default for gr.LoginButton and gr.DuplicateButton Sep 3, 2024
Copy link
Collaborator

@hannahblair hannahblair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested in mobile and desktop, looks great! thanks @abidlabs!

Screenshot 2024-09-04 at 00 18 29 Screenshot 2024-09-04 at 00 18 20

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@abidlabs
Copy link
Member Author

abidlabs commented Sep 3, 2024

Thanks all!

@abidlabs abidlabs merged commit 03f3735 into 5.0-dev Sep 3, 2024
19 of 21 checks passed
@abidlabs abidlabs deleted the clear-btn branch September 3, 2024 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants