carbon-design-system / carbon-components-svelte

Svelte implementation of the Carbon Design System
https://svelte.carbondesignsystem.com
Apache License 2.0
2.68k stars 261 forks source link

Support minCount in TextArea component #1928

Open mrbrianevans opened 6 months ago

mrbrianevans commented 6 months ago

Request for TextArea component minCount prop

Currently there is a maxCount prop on the TextArea component that limits the number of allowed characters to be below a certain number.

https://svelte.carbondesignsystem.com/components/TextArea#maximum-character-count

For different use cases, it would be very useful to be able to specify a minCount, that requires the user to type a minimum number of characters, also showing the character count as maxCount does.

If the length of input is below minCount it should put the component in an invalid state and indicate that more characters are required.

This could be implemented by users of the library if there was a prop showCharacterCount or similar, that didn't put a restriction on maxCount but shows the character count in the top right.

image

theetrain commented 6 months ago

Seeing that the core React library doesn't have a minCount prop, this requires upstream designs. I recommend opening a ticket in https://github.com/carbon-design-system/carbon/issues to kick off this functionality.