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: counterFormatter for counter string in ion-item #24327

Closed
3 tasks done
sean-perkins opened this issue Dec 6, 2021 · 2 comments
Closed
3 tasks done

feat: counterFormatter for counter string in ion-item #24327

sean-perkins opened this issue Dec 6, 2021 · 2 comments
Labels
package: core @ionic/core package type: feature request a new feature, enhancement, or improvement v6 issues specific to Framework v6

Comments

@sean-perkins
Copy link
Contributor

Prerequisites

Describe the Feature Request

Introduced in v6 is the ability for developers to use counter with an ion-item, to display max length validation to the user. Developers should have complete control over the formatted appearance of this counter. Currently they are stuck with 5 / 10 formatting.

Describe the Use Case

Users that are less technical or are unfamiliar of max length formatting, may be confused when seeing a 5 / 10 label. This feature would allow developers to customize the format of the display to say "4 characters remaining" or "5 out of 10 words".

Describe Preferred Solution

ion-item exposes a formatter function that takes in the input's text content length and the max length validation and returns a formatted string.

Describe Alternatives

No response

Related Code

counterFormatter(inputLength, maxLength) {
   return `${maxLength - inputLength} characters remaining`;
}
<ion-input [counter]="true" [counterFormatter]="counterFormatter">
   <ion-label position="stacked">Input</ion-label>
   <ion-input maxlength="20"></ion-input>
</ion-input>

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Dec 6, 2021
@sean-perkins sean-perkins added package: core @ionic/core package type: feature request a new feature, enhancement, or improvement labels Dec 6, 2021
@ionitron-bot ionitron-bot bot removed triage labels Dec 6, 2021
@sean-perkins sean-perkins added the v6 issues specific to Framework v6 label Dec 6, 2021
@sean-perkins sean-perkins changed the title feat: counterFormatter for counter string in ion-item feat: counterFormatter for counter string in ion-item Dec 9, 2021
@sean-perkins
Copy link
Contributor Author

This feature will be available in the upcoming 6.1.0 release.

@ionitron-bot
Copy link

ionitron-bot bot commented May 12, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators May 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: feature request a new feature, enhancement, or improvement v6 issues specific to Framework v6
Projects
None yet
Development

No branches or pull requests

1 participant