-
Notifications
You must be signed in to change notification settings - Fork 614
Textarea: Add minHeight
and maxHeight
as props
#6182
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 5777c3b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for customizing the textarea’s height by introducing minHeight
and maxHeight
props.
- Adds
minHeight
andmaxHeight
to theTextareaProps
and applies them via inline styles - Updates tests and stories to cover the new props
- Documents the new props and includes a changeset for a minor release
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
packages/react/src/Textarea/Textarea.tsx | Added minHeight /maxHeight props and style handling |
packages/react/src/Textarea/Textarea.test.tsx | Added tests for minHeight and maxHeight styles |
packages/react/src/Textarea/Textarea.features.stories.tsx | Added feature stories showcasing the new props |
packages/react/src/Textarea/Textarea.docs.json | Documented the new props in the generated JSON docs |
.changeset/social-ants-bow.md | Created changeset for a minor release |
Comments suppressed due to low confidence (1)
packages/react/src/Textarea/Textarea.tsx:40
- Consider allowing both string and number types for CSS flexibility (e.g. '2rem', '50%') by typing
minHeight
/maxHeight
asCSSProperties['minHeight']
instead ofnumber
only.
minHeight?: number
@@ -78,6 +88,10 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>( | |||
rows={rows} | |||
cols={cols} | |||
className={classes.TextArea} | |||
style={{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] User-supplied style
props may override these height settings; consider merging existing rest.style
first (e.g. style={{ ...rest.style, minHeight, maxHeight }}
) to avoid unintentional overrides.
style={{ | |
style={{ | |
...rest.style, |
Copilot uses AI. Check for mistakes.
/** | ||
* The minimum height of the Textarea | ||
*/ | ||
minHeight?: number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we use small/medium/large/xlarge instead? 🤔 CC: @langermank
I noticed that we directly expose e.g. we could do (cc: @langermank, @francinelucca) |
if we're not going to "Standardize" the sizes then I feel better with opting for just the existing style prop for these type of changes, i.e. no changes needed. But will defer to @langermank for final call |
Closes https://github.com/github/primer/issues/5296
Adds new props
minHeight
andmaxHeight
to theTextarea
. This allows you to customize the min/max height of the textarea directly.Changelog
New
minHeight
andmaxHeight
props toTextarea
Rollout strategy
Testing & Reviewing
Merge checklist