Closed WH-Yoshi closed 2 months ago
Hi @WH-Yoshi makes sense. We could add this to our roadmap, though it'll likely take time as we are focused on other things at the moment. Would like to open a PR for this? If so, we are happy to review and provide feedback
I'm happy to help
HI @abidlabs, I'm reading the source code and I'm trying to figure out how everything works. I found the svelte file and modified it to try it, but I might need a "first steps" guide to test it locally. Thanks !
To test it locally, you can run pnpm dev
to run the frontend server in reload mode. See here: https://github.com/gradio-app/gradio/blob/main/CONTRIBUTING.md#-run-a-gradio-app -- lmk if you have any questions!
Sorry to come again, I found how to change the web page thanks to a svelte parameter, if I put a default value on Textbox.svelte it works. Now, I was searching to understand how the python textbox component would communicate its values with the svelte component, I couldn't find anything besides a certain api_info
in the many Typescripts, that seems to work as an intermediary between the two languages. Do you have any clues to give?
Great question @WH-Yoshi -- if you add a parameter in the component's Python gr.Textbox
constructor (and save it as an attribute of the class: self.max_length = max_length
, then it will automatically be passed into the Svelte component as a prop)
Is your feature request related to a problem? Please describe.
No problem related, just a useful feature in my opinion.
Describe the solution you'd like
The "solution" could be useful for some people, such as me :) My request is a parameter that applies a maximum of characters we can put into an interactive textbox. I tried with event listeners but the component refreshes at every character we put so it becomes quite a mess. I know that HTML as a built-in maxlenght attribute, maybe add this one to the textarea if we ask for the parameter?
Additional context
Can't type 10 here thanks to
maxlenght="20"
in<textarea>