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(Textarea): add char counter #987

Closed
wants to merge 1 commit into from
Closed

feat(Textarea): add char counter #987

wants to merge 1 commit into from

Conversation

maxsteinwand
Copy link
Contributor

πŸ”— Linked issue

Resolves #971

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Adds a counter and persistent-counter property to the textarea to show the amount of typed chars. The counter prop can be a Boolean, Number or String. If set to a number or String the value will be parsed into the maxValue and displayed. The counter will show if the user is focusing the Textarea (VueUse useFocus) or the persistent-counter Boolean is set to true.

It also adds a slot for the counter passing the focused, letterCount and maxValue variables so that the user can fully customize the looks.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link

vercel bot commented Nov 17, 2023

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Updated (UTC)
ui ❌ Failed (Inspect) Nov 17, 2023 2:49pm

Copy link
Member

This is a really niche feature in my opinion, not sure we should add this into the Textarea directly. Maybe an example on how to achieve this would be better?

@maxsteinwand
Copy link
Contributor Author

@benjamincanac I added an example to the Ticket. You can close the PR then if you'd like.

Copy link
Member

I mean we could create a full example component to add to this page: https://ui.nuxt.com/getting-started/examples instead.

The Textarea would have to be updated with only a <slot /> inside like the Input.

@maxsteinwand maxsteinwand deleted the feat/Counter branch November 20, 2023 06:38
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

Successfully merging this pull request may close these issues.

Add real-time word count display function in the lower right corner of Textarea
2 participants