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

Input templates #4581

Open
amottola opened this issue May 31, 2024 · 1 comment
Open

Input templates #4581

amottola opened this issue May 31, 2024 · 1 comment

Comments

@amottola
Copy link
Contributor

Hi all,

I see templates are on the roadmap for Input widget, and since I need them on one of my projects, I'd like to give it a try. I'm opening this issue for discussion with the goal of making my first contribution to textual.

I propose to add a template reactive attribute to Input that emulates the behavior of Qt input masks, since this is what I'm used to and I think it allows enough freedom to cover all the use cases mentioned in the roadmap (I see IP address, physical units, currency, credit card) and more. Since Qt input masks are well documented, I'm not going to copy the docs here; just have a look at the link above. They are also effective as they are used in many production environments.

As an extension however, I'd like to add the possibility to specify more than a single blank character after the optional final ;: for this I propose to reuse the placeholder text, which when used in conjunction with template is always made visible even if Input value is not empty. The placeholder covers untyped content only and is dimmed of course. If blank character is specified in the template string, it has a precedence over placeholder.

This should allow for templates suitable to help in the development of the date picker widget (#3576), something like:

date_input = Input(template='0000-00-00', placeholder='YYYY-MM-DD')

Thoughts?

Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@amottola amottola mentioned this issue Jun 3, 2024
3 tasks
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

No branches or pull requests

1 participant