[material-ui][Text Field] Multiline variant cannot be made to scroll horizontally #41490
Labels
component: text field
This is the name of the generic UI component, not the React module!
enhancement
This is not a bug, nor a new feature
package: material-ui
Specific to @mui/material
Summary
The
TextareaAutosize
when rendered by aTextField
with multiline appliesoverflow: hidden
to the resulting textarea dom element as an inline style in the current implementation.This prevents the usecase I have, which is a textarea form input element that can grow vertically based on the size of the text contents, while also respecting whitespace and scrolling in the horizontal direction.
The fix should be as simple as splitting the
overflow
intooverflow-x
andoverflow-y
and applying these as css instead of inline styles so they can be overwritten.Examples
https://github.com/mui/material-ui/blob/master/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx#L135 (existing implementation)
Desired configurable behavior in in mp4 format:
![Desired behavior](https://private-user-images.githubusercontent.com/40526638/312681357-0fba0e90-863d-4288-8e37-0b7aae2c6144.mp4?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIzODE1NTUsIm5iZiI6MTcyMjM4MTI1NSwicGF0aCI6Ii80MDUyNjYzOC8zMTI2ODEzNTctMGZiYTBlOTAtODYzZC00Mjg4LThlMzctMGI3YWFlMmM2MTQ0Lm1wND9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzMwVDIzMTQxNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWUzZTc3NjJmZmU5NGIxNDc1Y2E5ZjZmZTY3OTUyMDNiZGNmZWFiMmE1ZWY1MjMzMTAyNzA2NDAwNjBhZjNlNjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.7d1vm6OkGNmc3ZVkeOrMdEE4HyTDkjWFcB86W3XW4oE)
Motivation
I am trying to make a
Textfield
that renders as a textarea, while allowing me to scroll horizontally while respecting whitespace. Preserving the behavior of: expanding vertically dynamically based on the users input, as many lines as necessary without restriction (the same as the currentTextareaAutosize
implementation).I know I could assign a max number of rows. But I think there is a valid usecase with the want to expand vertically in an unlimited fashion within a scroll container, while also being able to override the inline overflow style.
Search keywords: textfield textarea mui core
The text was updated successfully, but these errors were encountered: