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

Adding maxlength attribute handling of textarea and input HTML element for the gr.TextBox() component via a max_length parameter #9185

Merged
merged 13 commits into from
Aug 27, 2024

Conversation

WH-Yoshi
Copy link
Contributor

Description

This PR aims to be able to modify the maximum number of characters to insert in a gr.TextBox().
To do this, a max_length parameter is added to the gr.TextBox() component.
This results in the modification of the svelte files for this component with the addition of a prop handler named max_length which will give its value to the HTML attribute maxlength responsible for the limit.

Closes: #9145

All tests have been run, some of them failed for unknown reasons or not caused by the modification of these last files.

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Aug 23, 2024

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
Storybook ready! Storybook preview
🦄 Changes detecting...

Install Gradio from this PR

pip install https://gradio-pypi-previews.s3.amazonaws.com/7e61de7189376dbc10042a791ae0025b8789f3ec/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@7e61de7189376dbc10042a791ae0025b8789f3ec#subdirectory=client/python"

Install Gradio JS Client from this PR

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

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Aug 23, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

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

With the following changelog entry.

Adding maxlength attribute handling of textarea and input HTML element for the gr.TextBox() component via a max_length parameter

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.

@WH-Yoshi
Copy link
Contributor Author

Thanks @abidlabs for the clues!

@WH-Yoshi WH-Yoshi closed this Aug 27, 2024
@abidlabs
Copy link
Member

Hi @WH-Yoshi is there a reason you closed this PR?

@WH-Yoshi
Copy link
Contributor Author

Hi yes, the tests are unsuccessful and I don't find the issue, so I wanted to make sure on my part before opening a PR maybe

@abidlabs
Copy link
Member

abidlabs commented Aug 27, 2024

You mind if I reopen and take a quick look?

@WH-Yoshi
Copy link
Contributor Author

Sure, I'm a bit lost ngl

@abidlabs abidlabs reopened this Aug 27, 2024
Copy link
Member

@abidlabs abidlabs left a comment

Choose a reason for hiding this comment

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

LGTM @WH-Yoshi, thanks for the nice PR! Just made a small addition to gradio/templates.py

@abidlabs abidlabs changed the title Adding maxlength attribute handling of textarea and input HTML element for the gr.TextBox() component Adding maxlength attribute handling of textarea and input HTML element for the gr.TextBox() component via a max_length parameter Aug 27, 2024
@abidlabs abidlabs enabled auto-merge (squash) August 27, 2024 23:30
@abidlabs abidlabs merged commit 2daf3d1 into gradio-app:main Aug 27, 2024
21 checks passed
This was referenced Aug 27, 2024
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.

Adding max_length parameter to gr.TextBox()
3 participants