ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
50.47k stars 13.53k forks source link

feat: ion-searchbar helperText #29372

Closed donhmorris closed 3 weeks ago

donhmorris commented 3 weeks ago

Prerequisites

Describe the Feature Request

Would be helpful to have a helperText property on the ion-searchbar that works the same as the helperText for ion-input.

Describe the Use Case

Provide helper text (similar to the helperText of ion-input) to provide guidance to users. An example would be "Enter a min of 3 characters to search"

Describe Preferred Solution

Mimic how the helperText feature works for ion-input.

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

liamdebeasi commented 3 weeks ago

Do you have any examples of applications that implement this pattern?

donhmorris commented 3 weeks ago

It's not clear to me if you are asking for en example of using a searchbar with helper text of if you are looking for an example of how the existing helperText feature works for ion-input. Can you give more clarification of what you are asking?

The use case is the same as for ion-input; provide help text to the user. For example, the app I am currently working on requires a min of 4 characters to initiate a search of user names. Since there can be a million or more user names to search, 4 chars are required to begin a search. A helperText feature that works like the ion-input would be used to inform users of the 4 char requirement and that searches are case insensitive.

Does this description help or is there something else I can do?

liamdebeasi commented 3 weeks ago

I would like to know if there is an example of a real world application that uses helper text with a searchbar. The helper/error text in Ionic was designed for the Material Design specification which does not include helper text for the Searchbar. However, if there are examples of this in existing apps then the team might want to consider adding it.

donhmorris commented 3 weeks ago

Ahh. That explains why it is not there now. I will do some research. It seems like an obvious omission to me. The use case I shared is a good example. Searches are frequently (but not always) case insensitive. When I use one it is always the first thing i question. "Is this doing a case insensitive search?" Would my app qualify as a valid use case? 😀 It is about 4 to 6 months away from being published. Here is a screenshot of a workaround I did for helper text. Simulator Screenshot - iPhone 15 - 2024-04-22 at 15 17 02

liamdebeasi commented 3 weeks ago

Thanks for the additional info! I spoke with the team, and we don't have plans to add this functionality at the moment. The helper/error text was originally intended to be used with form validation such as password strength and email validation. I recommend using the solution you demonstrated in the screenshot above.

donhmorris commented 3 weeks ago

I understand. I checked the md site and they did not have a provision for helper text.

I'm going to try suggesting the addition to the md team. If they decide to go with it, I will contact you guys.