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

Add kwargs to input components to pass to ipyvuetify #154

Open
LostCorgi opened this issue Jun 15, 2023 · 4 comments
Open

Add kwargs to input components to pass to ipyvuetify #154

LostCorgi opened this issue Jun 15, 2023 · 4 comments

Comments

@LostCorgi
Copy link

Some features like placeholders and hint text are found in the reacton ipyvuetify TextField that could be easily incorporated this way for all the input components based on it.

@maartenbreddels
Copy link
Contributor

Hi,

this issue was also raised in #50
But that would loose type/argument safety (e.g. you can pass in anything argument that is unsupported). What we can do, is instead of **kwargs is to have a textfield_kwargs argument, that will pass the argument specifically to the textfield component. Since some components are composites, this leaves us with the option to have more <name>_kwargs arguments.
But, I am also in favor of adding more arguments to components, if they seem quite general, and are not too niche (I don't think we should expose the full vuetify API).

Does this make sense? And are you ok opening a PR for a specific component you need?

Regards,

Maarten

@LostCorgi
Copy link
Author

Hi Maarten,

I'm not all that confident with type safety or making PR requests, but I think there's a better alternative to kwargs actually: based on the reacton API, there is a massive number of additional named/typed parameters that can be passed to its wrapper for TextField. I've tried copy-pasting the solara version with **kwargs into a notebook to try it, and it works for me. So, I imagine if the concern is that you need the named/typed arguments, you could just copy and paste the added arguments over from reacton over to where it's used in https://github.com/widgetti/solara/blob/master/solara/components/input.py (just the 2 instances of v.TextField).

https://github.com/widgetti/reacton/blob/master/reacton/ipyvuetify.py line 6538 for TextField, and many of the other widgets have a similarly large number of parameters.

Also, although this is not exactly relevant, would you happen to know if there's any reacton state/widget state and traitlet linking? implementing a callback with on_value works well enough. Currently I'm trying to go past ipywidgets (lacks the widgets and some of the customization I'd like, but I got used to the traitlets) but not have to deal with the kinda terrible documentation of ipyvuetify.

@maartenbreddels
Copy link
Contributor

You can still use the ipyvuetify components, in fact, we have solara.v as an alias for that. Solara provides its own components which are based on vuetify, but with a less overwhelming, more documented, opinionated and typed set of arguments compared to vuetify.

Regarding the traitlets, could you maybe open a new issue for that, and maybe give some code example what you want to do, my guess is that you are not the only one who wants to do that.

@LostCorgi
Copy link
Author

I am aware that the solara widgets are based on the ipyvuetify ones, but it's for precisely a lot of the reasons listed that I'd rather have the solara version, since ipyvuetify doesn't really have Text/Int/Float input fields, and relies far too much on vuetify for its docs, which are all in javascript. Aside from some input filtering, the solara input fields appears to be really just the reacton TextField, which appears to have a comprehensive list of additional parameters it can pass to ipyvuetify. Basically, I don't really want to use ipyvuetify at all, just have its UI elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants