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

feat: Add NumberInput in bubbles #481

Open
anirudhaCodes opened this issue Feb 14, 2024 · 4 comments
Open

feat: Add NumberInput in bubbles #481

anirudhaCodes opened this issue Feb 14, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@anirudhaCodes
Copy link
Contributor

anirudhaCodes commented Feb 14, 2024

Is your feature request related to a problem? Please describe.
Currently, Bubbles lacks a component for numeric input fields. Users may require this functionality for various use cases, such as collecting numerical data (Number only) or setting numeric parameters.

Describe the solution you'd like

I would like to propose adding a NumberInput component to our library. This component would provide users with a text input field specifically designed for entering numeric values. It should support pasting functionality. Additionally, it should offer customization options for styling and behavior to suit different application needs.

Describe alternatives you've considered

One alternative could be using a standard text input field and validating the input on the client-side to ensure it only accepts numeric values. However, this approach may not provide the user with a consistent experience and could require additional effort for input validation and error handling.

[Assign this to Me.]
[should we add this feat in textInput or should we create numberInput]

@anirudhaCodes anirudhaCodes added the enhancement New feature or request label Feb 14, 2024
@meowgorithm
Copy link
Member

Hi! So actually textinput contains a Validate property which can be used to restrict input to numbers only. The credit card example illustrates how to do this.

@anirudhaCodes
Copy link
Contributor Author

@meowgorithm Thank you for the reply.
In the Bubbles library, are various input types like number, email, password (hiding text), URL, etc., intended to be implemented using the Validate property of textInput, or are there plans to introduce specific components or features for these input types in the future?

@meowgorithm
Copy link
Member

So most of these can be done with textinput and the plan is to remain that way for maintainability unless there are good reasons to introduce new inputs. You raise a good point about documentation however.

For password input you can set EchoMode on textinput.Model to EchoPassword:

import "github.com/charmbracelet/bubbles/textinput"

passwordInput := textinput.New()
passwordInput.EchoMode = textinput.EchoPassword

@anirudhaCodes
Copy link
Contributor Author

Understood. I was just trying to contribute to the codebase.
As I'm interested in contributing to the Bubbles library (or any other Charm library), I'm curious about the roadmap for future components or features. Are there any plans or discussions regarding upcoming components or enhancements that could use contributions from the community? It would be helpful to know if there are any specific areas where contributions would be particularly valuable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants