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

[RFC] How to add a label in TextareaAutosize? #38821

Closed
ooguuiholiv opened this issue Sep 5, 2023 · 4 comments
Closed

[RFC] How to add a label in TextareaAutosize? #38821

ooguuiholiv opened this issue Sep 5, 2023 · 4 comments
Labels
component: TextareaAutosize The React component. package: base-ui Specific to @mui/base

Comments

@ooguuiholiv
Copy link

What's the problem? πŸ€”

No response

What are the requirements? ❓

No response

What are our options? πŸ’‘

No response

Proposed solution 🟒

No response

Resources and benchmarks πŸ”—

No response

@ooguuiholiv ooguuiholiv added RFC Request For Comments status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Sep 5, 2023
@DiegoAndai
Copy link
Member

@oguuiholiv hi! Are you referring to the TextareaAutosize from Base UI? Please provide more information so I can help you.

@DiegoAndai DiegoAndai self-assigned this Sep 5, 2023
@DiegoAndai DiegoAndai added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer RFC Request For Comments labels Sep 5, 2023
@ooguuiholiv
Copy link
Author

import { TextareaAutosize } from "@mui/material";
https://mui.com/base-ui/react-textarea-autosize/components-api/#textarea-autosize

It is this materialUi component, according to the documentation there is no way to add a label to the component

@github-actions github-actions bot removed the status: waiting for author Issue with insufficient information label Sep 5, 2023
@zannager zannager added component: TextareaAutosize The React component. RFC Request For Comments labels Sep 6, 2023
@DiegoAndai
Copy link
Member

DiegoAndai commented Sep 6, 2023

The TextareaAutosize component you can import from Material UI comes from Base UI, our unstyled component library. Material UI reexports the component for convenience.

If you want to add a label to Base UI's unstyled TextareaAutosize, you use Base UI's FormControl. Here's a CodeSandbox example of how to do this: https://codesandbox.io/s/38821-base-ui-form-control-textarea-lrv8vr?file=/Demo.tsx.

If you want to add a label to a Material UI text area with auto size, you can provide the multiline and label props to the TextField component without setting the rows prop. Here's a CodeSandbox example of how to do this: https://codesandbox.io/s/38821-material-ui-text-field-with-label-9ktsy7?file=/Demo.js

Does this cover your use case?

@ZeeshanTamboli
Copy link
Member

ZeeshanTamboli commented Feb 18, 2024

@ooguuiholiv Alternatively, if you prefer a basic label, you can use the label HTML element and link it to the textarea autosize: https://stackblitz.com/edit/stackblitz-starters-ob3pbr.

I think we can close this issue.

@ZeeshanTamboli ZeeshanTamboli added package: base-ui Specific to @mui/base and removed RFC Request For Comments labels Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: TextareaAutosize The React component. package: base-ui Specific to @mui/base
Projects
None yet
Development

No branches or pull requests

4 participants