charmbracelet / charmbracelet/bubbles

Validate func on textinput doesn't restrict input

Open
#691 3 comments 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
8.9k
Forks
457
Avg merge
1d 18h
Merged PRs (30d)
5

Description

Hi! So actually `textinput` contains a [`Validate`](https://pkg.go.dev/github.com/charmbracelet/bubbles@v0.18.0/textinput#Model) property which can be used to restrict input to numbers only. The [credit card example](https://github.com/charmbracelet/bubbletea/tree/master/examples/credit-card-form) illustrates how to do this.

_Originally posted by @meowgorithm in https://github.com/charmbracelet/bubbles/issues/481#issuecomment-1944368917_

This does not seem to be working as of v0.20.0. And I don't see a KeyMsg.Type for keyboard numbers to intercept the messages with non-numerical inputs.

Is there a way to easily circumvent this issue?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.