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

[Bug]: PromptInput defaults to maxRows of 3 even though docs state there is no default #3283

Open
2 tasks done
purplepenguin2 opened this issue Feb 11, 2025 · 7 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@purplepenguin2
Copy link

Browser

No response

Package version

3.0.895

React version

19.0.0

Description

I wanted a resize-able textarea, and since the base/normal Textarea component doesn't expose any way to dynamically check/set the height, I found the PromptInput is basically just a Textarea that supports dynamic resizing by default.

Currently if you don't pass maxRows, it defaults to 3, but the docs state there is no default. Is it possible to remove the default, or support passing null or something? I can pass in an arbitrary large value like 99999999 but it seems a bit hacky.

tl;dr - the PromptInput component should simply resize with no limit by default and only enforce limits if the props are actually set on the component.

https://cloudscape.design/components/prompt-input?tabId=api

Source code

No response

Reproduction

No response

Code of Conduct

@purplepenguin2 purplepenguin2 added the bug Something isn't working label Feb 11, 2025
@purplepenguin2
Copy link
Author

purplepenguin2 commented Feb 11, 2025

On a side note / tangent, it'd be great if the base Textarea component simply supported dynamically/reactive resizing.

@katiegeorge
Copy link
Member

Good catch! This is unexpected. For now, you can do the 9999 solution. It is perhaps "hacky", but should work for your use case.

@purplepenguin2
Copy link
Author

Just commenting to remove the response requested since it seems just an issue of priority, nothing further is needed from me.

@jperals
Copy link
Member

jperals commented Feb 27, 2025

Hi, I am looking into updating the documentation accordingly: #3320

I am curious about your need for an infinite value. I would say, in general it is good to have a constraint by design in order to keep the page usable —letting the textarea become scrollable instead when the maximum is reached. Is there a reason why you would need to let the user stretch the field without limit?

@purplepenguin2
Copy link
Author

To clarify, I'm not saying it needs to be truly infinite, but I think a max row count of 3 by default is unnecessarily restrictive. I'd expect it to at least be like 20 or some higher value. At the same time, I also think infinite is still fine, because if someone wants to cap it at X rows, they can just pass X as the value to maxRows.

It doesn't make sense to me to support a value called maxRows but still enforce a max even if it's not set, especially one as low as 3. Or at the very least support passing null or something. Using something like Number.MAX_VALUE or some other hardcoded constant feels very hacky, even though it technically works.

@jperals
Copy link
Member

jperals commented Feb 28, 2025

Thanks for the extra info. I am discussing this further with the team.

@jperals
Copy link
Member

jperals commented Mar 6, 2025

The API docs were updated to document the current behavior.

Changing these default values is not something we consider because it would break the expected behavior of existing usages of the component. We consider however adding a more idiomatic way of unsetting the limit as you suggest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants