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

[docs] TextField examples have endAdornment as a prop, but implementation requires it on InputProps #31421

Open
2 tasks done
brandonscript opened this issue Mar 11, 2022 · 3 comments
Labels
component: text field This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation

Comments

@brandonscript
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

In the docs here: https://mui.com/components/text-fields/#main-content

It shows that a standard TextField should take an endAdornment prop directly:

<TextField
  label="Size"
  endAdornment={<InputAdornment position="end">
      <Typography variant="caption">asdf</Typography>
    </InputAdornment>}
/>

But the actual implementation seems to require it to be inside InputProps:

<TextField
  label="Size"
  InputProps={{
    endAdornment: <InputAdornment position="end">
        <Typography variant="caption">asdf</Typography>
      </InputAdornment>
  }}
/>

I'm not really sure where the correct place to update the docs is (likely in the code definition itself?) If you agree this is wrong, and can point me where the right place to update it is, I can send a PR in.

Expected behavior 🤔

Docs might be wrong? Should be

<TextField
  label="Size"
  InputProps={{
    endAdornment: <InputAdornment position="end">
        <Typography variant="caption">asdf</Typography>
      </InputAdornment>
  }}
/>

Steps to reproduce 🕹

N/A

Context 🔦

N/A

Your environment 🌎

N/A

@brandonscript brandonscript added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Mar 11, 2022
@danilo-leal danilo-leal changed the title TextField examples have endAdornment as a prop of TextField, but implementation requires it on InputProps [docs] TextField examples have endAdornment as a prop, but implementation requires it on InputProps Mar 11, 2022
@danilo-leal danilo-leal added docs Improvements or additions to the documentation component: text field This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 11, 2022
@danilo-leal
Copy link
Contributor

danilo-leal commented Mar 11, 2022

Hey @brandonscript, thanks for opening up the issue!

It shows that a standard TextField should take an endAdornment prop directly

Could you point to where exactly on the page this is shown?

@brandonscript
Copy link
Author

Sure! Sorry. Under Input Adornments, in the TypeScript example:
Screen Shot 2022-03-11 at 12 22 31 PM

@danilo-leal
Copy link
Contributor

danilo-leal commented Mar 11, 2022

Got it, thank you!

It's definitely an improvement opportunity for the Text Field documentation. The components that receives the endAdornment prop directly are FilledInput, Input, InputBase, InputUnstyled, and OutlinedInput but not the TextField itself — all sub-components of it.

The docs don't seem to imply "that a standard TextField should take an endAdornment prop directly" as mentioned, though I agree this could be clarified!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: text field This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation
Projects
None yet
Development

No branches or pull requests

2 participants