style-guide icon indicating copy to clipboard operation
style-guide copied to clipboard

New props suggestions "counter" and "limit" and "showRemaining" for the Textarea component

Open seahindeniz opened this issue 3 years ago • 1 comments

Hi

What do you think about support for 3 additional, value + event related props?

counter prop is for adding a counter at the bottom right corner of the textarea to show, how many characters was entered. limit prop is for limiting option to have a character limit on the component. This is kind a useful when input needs to be limited to a pre-defined number. showRemaining prop, can be a side prop for limit in order to show how many characters remain. Something like, 28/100 to show 28 characters of 100 left.

Type definition:

| {
    limit?: null;
  }
| {
    limit: number;
    showRemaining: boolean;
  }

seahindeniz avatar Nov 11 '20 07:11 seahindeniz

Hey @seahindeniz , let me discuss that with the team as at first glance it looks like introducing unnecessary complexity to the low level visual only component.

Regarding typing we are moving away from ambiguous union types for component props since they are not handled properly in doc generators and parsers (eg in storybook).

coderitual avatar Nov 11 '20 20:11 coderitual